All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.soento.core.exception.ClientException Maven / Gradle / Ivy

package com.soento.core.exception;

import com.soento.core.lang.Message;
import com.soento.core.support.MessageSourceAccessor;

/**
 * @author soento
 */
public class ClientException extends ServiceException {
    public ClientException() {
        super();
    }

    public ClientException(Message message) {
        super(message);
    }

    public ClientException(Message message, Throwable cause) {
        super(message, cause);
    }

    public static ClientException build(String code, String content) {
        Message message = new Message();
        message.setCode(code);
        message.setContent(content);
        return new ClientException(message);
    }

    public static ClientException build(MessageSourceAccessor msa, String code, String... args) {
        Message message = new Message();
        message.setCode(code);
        message.setContent(msa.getMessage(code, args));
        return new ClientException(message);
    }

    public static ClientException build(Throwable cause, String code, String content) {
        Message message = new Message();
        message.setCode(code);
        message.setContent(content);
        return new ClientException(message, cause);
    }

    public static ClientException build(Throwable cause, MessageSourceAccessor msa, String code, String... args) {
        Message message = new Message();
        message.setCode(code);
        message.setContent(msa.getMessage(code, args));
        return new ClientException(message, cause);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy