- Restructure handlers into file_commands/file_queries/file_handlers - Add gRPC auth client, JWT middleware, rate limiting, request ID - Add common utilities: logger, sanitizer, s3_errors - Add unit tests for config, mediator, auth, request_id, sanitize - Add proto definitions and generated code - Remove old web UI pages - Add .dockerignore and .env.example
39 lines
688 B
Go
39 lines
688 B
Go
package common
|
|
|
|
type BusinessException struct {
|
|
Message string
|
|
Code int
|
|
}
|
|
|
|
func (e *BusinessException) Error() string {
|
|
return e.Message
|
|
}
|
|
|
|
func NewBusinessException(message string) *BusinessException {
|
|
return &BusinessException{
|
|
Message: message,
|
|
Code: 400,
|
|
}
|
|
}
|
|
|
|
func NewNotFoundError(message string) *BusinessException {
|
|
return &BusinessException{
|
|
Message: message,
|
|
Code: 404,
|
|
}
|
|
}
|
|
|
|
func NewConflictError(message string) *BusinessException {
|
|
return &BusinessException{
|
|
Message: message,
|
|
Code: 409,
|
|
}
|
|
}
|
|
|
|
func NewBusinessExceptionWithCode(code int, message string) *BusinessException {
|
|
return &BusinessException{
|
|
Message: message,
|
|
Code: code,
|
|
}
|
|
}
|