forked from free-lancers/electricity_bill_calc_service
		
	feat(exception):增加用于表示参数错误的异常。
This commit is contained in:
		
							
								
								
									
										19
									
								
								exceptions/illegal_arguments.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								exceptions/illegal_arguments.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| package exceptions | ||||
|  | ||||
| import "fmt" | ||||
|  | ||||
| type IllegalArgumentsError struct { | ||||
| 	Message   string | ||||
| 	Arguments []string | ||||
| } | ||||
|  | ||||
| func NewIllegalArgumentsError(msg string, arguments ...string) IllegalArgumentsError { | ||||
| 	return IllegalArgumentsError{ | ||||
| 		Message:   msg, | ||||
| 		Arguments: arguments, | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (e IllegalArgumentsError) Error() string { | ||||
| 	return fmt.Sprintf("Illegal Arguments, %s", e.Message) | ||||
| } | ||||
		Reference in New Issue
	
	Block a user