-
Notifications
You must be signed in to change notification settings - Fork 192
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
1 parent
8b602c3
commit 0a6d7ec
Showing
8 changed files
with
85 additions
and
14 deletions.
There are no files selected for viewing
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
18 changes: 18 additions & 0 deletions
18
rpc-common/src/main/java/top/guoziyang/rpc/enumeration/RpcError.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,18 @@ | ||
package top.guoziyang.rpc.enumeration; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
/** | ||
* @author ziyang | ||
*/ | ||
@AllArgsConstructor | ||
@Getter | ||
public enum RpcError { | ||
|
||
SERVICE_INVOCATION_FAILURE("服务调用出现失败"), | ||
SERVICE_CAN_NOT_BE_NULL("注册的服务不得为空"); | ||
|
||
private final String message; | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
rpc-common/src/main/java/top/guoziyang/rpc/exception/RpcException.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,22 @@ | ||
package top.guoziyang.rpc.exception; | ||
|
||
import top.guoziyang.rpc.enumeration.RpcError; | ||
|
||
/** | ||
* @author ziyang | ||
*/ | ||
public class RpcException extends RuntimeException { | ||
|
||
public RpcException(RpcError error, String detail) { | ||
super(error.getMessage() + ": " + detail); | ||
} | ||
|
||
public RpcException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public RpcException(RpcError error) { | ||
super(error.getMessage()); | ||
} | ||
|
||
} |
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
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
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
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
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