diff --git a/app/api/usererror/translate.go b/app/api/usererror/translate.go index 83608fa84..93bacda95 100644 --- a/app/api/usererror/translate.go +++ b/app/api/usererror/translate.go @@ -87,6 +87,12 @@ func Translate(ctx context.Context, err error) *Error { case errors.As(err, &maxBytesErr): return RequestTooLargef("The request is too large. maximum allowed size is %d bytes", maxBytesErr.Limit) + case errors.Is(err, store.ErrLicenseExpired): + return BadRequestf("license expired.") + + case errors.Is(err, store.ErrLicenseNotFound): + return BadRequestf("license not found.") + // git errors case errors.As(err, &appError): if appError.Err != nil { diff --git a/store/errors.go b/store/errors.go index 922e537ca..f5fe9974f 100644 --- a/store/errors.go +++ b/store/errors.go @@ -32,4 +32,6 @@ var ( ErrSpaceWithChildsCantBeDeleted = errors.New("the space can't be deleted as it still contains " + "spaces or repos") ErrPreConditionFailed = errors.New("precondition failed") + ErrLicenseNotFound = errors.New("license not found") + ErrLicenseExpired = errors.New("license expired") )