]> WPIA git - gigi.git/blob - src/org/cacert/gigi/GigiApiException.java
Extract "verify" action into the bussiness logic api.
[gigi.git] / src / org / cacert / gigi / GigiApiException.java
1 package org.cacert.gigi;
2
3 import java.io.PrintWriter;
4 import java.sql.SQLException;
5
6 public class GigiApiException extends Exception {
7         SQLException e;
8         String message;
9
10         public GigiApiException(SQLException e) {
11                 this.e = e;
12         }
13
14         public GigiApiException(String message) {
15                 this.message = message;
16         }
17
18         public boolean isInternalError() {
19                 return e != null;
20         }
21
22         public void format(PrintWriter out, Language language) {
23                 if (isInternalError()) {
24                         e.printStackTrace();
25                         out.println(language.getTranslation("An internal error ouccured."));
26                 } else {
27                         out.println(language.getTranslation(message));
28                 }
29
30         }
31
32 }