Welcome to mirror list, hosted at ThFree Co, Russian Federation.

LocalizedException.java « i18n « bouncycastle « org « java « main « src « core - gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 373fd6cea9a94dbd480bec9b46cf410aa08b5ed7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package org.bouncycastle.i18n;

import java.util.Locale;

/**
 * Base class for all Exceptions with localized messages.
 */
public class LocalizedException extends Exception 
{

    protected ErrorBundle message;
    private Throwable cause;
    
    /**
     * Constructs a new LocalizedException with the specified localized message.
     * @param message the {@link ErrorBundle} that contains the message for the exception
     */
    public LocalizedException(ErrorBundle message) 
    {
        super(message.getText(Locale.getDefault()));
        this.message = message;
    }
    
    /**
     * Constructs a new LocalizedException with the specified localized message and cause.
     * @param message the {@link ErrorBundle} that contains the message for the exception
     * @param throwable the cause
     */
    public LocalizedException(ErrorBundle message, Throwable throwable) 
    {
        super(message.getText(Locale.getDefault()));
        this.message = message;
        this.cause = throwable;
    }
    
    /**
     * Returns the localized error message of the exception.
     * @return the localized error message as {@link ErrorBundle}
     */
    public ErrorBundle getErrorMessage() 
    {
        return message;
    }

    public Throwable getCause()
    {
        return cause;
    }
}