28 lines
603 B
Go
28 lines
603 B
Go
// SPDX-License-Identifier: MIT
|
|
|
|
package pdfexport
|
|
|
|
import "fmt"
|
|
|
|
type userError struct {
|
|
Status int
|
|
ErrorID string
|
|
Message string
|
|
}
|
|
|
|
func (e userError) Error() string {
|
|
return fmt.Sprintf("%s: %s", e.ErrorID, e.Message)
|
|
}
|
|
|
|
func errBadRequest(errorID, message string) userError {
|
|
return userError{Status: 400, ErrorID: errorID, Message: message}
|
|
}
|
|
|
|
func errNotFound(errorID, message string) userError {
|
|
return userError{Status: 404, ErrorID: errorID, Message: message}
|
|
}
|
|
|
|
func errInternal(errorID, message string) userError {
|
|
return userError{Status: 500, ErrorID: errorID, Message: message}
|
|
}
|
|
|