Skip to content

Commit

Permalink
新增:exception.ThrowWebExceptionError抛出WebException异常
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Sep 27, 2023
1 parent ca21a8f commit 82586d2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions exception/webException.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,11 @@ func ThrowWebExceptionfBool(isTrue bool, statusCode int, format string, a ...any
panic(WebException{StatusCode: statusCode, Message: fmt.Sprintf(format, a...)})
}
}


// ThrowWebExceptionError 抛出WebException异常
func ThrowWebExceptionError(statusCode int, err error) {
if err!=nil {
panic(WebException{StatusCode: statusCode, Message: err.Error()})
}
}

0 comments on commit 82586d2

Please sign in to comment.