-
Notifications
You must be signed in to change notification settings - Fork 588
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
griffin-metric/src/main/java/org/apache/griffin/metric/exception/GriffinErr.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.apache.griffin.metric.exception; | ||
|
||
import lombok.Getter; | ||
|
||
public enum GriffinErr { | ||
commonError(100, ""); | ||
|
||
@Getter | ||
private int code; | ||
|
||
@Getter | ||
private String message; | ||
|
||
GriffinErr(int code, String message) { | ||
this.code = code; | ||
this.message = message; | ||
} | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
griffin-metric/src/main/java/org/apache/griffin/metric/exception/GriffinException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,28 @@ | ||
package org.apache.griffin.metric.exception; | ||
|
||
import lombok.Getter; | ||
|
||
public class GriffinException extends RuntimeException { | ||
@Getter | ||
private final int errorCode; | ||
|
||
public GriffinException(String message) { | ||
super(message); | ||
this.errorCode = GriffinErr.commonError.getCode(); | ||
} | ||
|
||
public GriffinException(Throwable cause) { | ||
super(cause); | ||
this.errorCode = GriffinErr.commonError.getCode(); | ||
} | ||
|
||
public GriffinException(String message, Throwable cause) { | ||
super(message, cause); | ||
this.errorCode = GriffinErr.commonError.getCode(); | ||
} | ||
|
||
public GriffinException(String message, int errorCode) { | ||
super(message); | ||
this.errorCode = errorCode; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters