fleet/ee/server/service/errors.go
Victor Lyuboslavsky cab2426bf4
Added better handling of timeout and insufficient permissions errors in NDES SCEP proxy. (#23654)
#23525

# Demo
<div>
<a href="https://www.loom.com/share/e252ac2038b34941a9043867f79228f3">
<p>[Demo] Handling timeout and insufficient permission errors in NDES
#23525 - Watch Video</p>
    </a>
<a href="https://www.loom.com/share/e252ac2038b34941a9043867f79228f3">
<img style="max-width:300px;"
src="https://cdn.loom.com/sessions/thumbnails/e252ac2038b34941a9043867f79228f3-2ff60eb9e0f54dd5-full-play.gif">
    </a>
  </div>

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/Committing-Changes.md#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-11-11 14:57:28 -06:00

55 lines
1.1 KiB
Go

package service
import (
"github.com/fleetdm/fleet/v4/server/fleet"
)
type notFoundError struct {
fleet.ErrorWithUUID
}
func (e notFoundError) Error() string {
return "not found"
}
// IsNotFound implements the service.IsNotFound interface (from the non-premium
// service package) so that the handler returns 404 for this error.
func (e notFoundError) IsNotFound() bool {
return true
}
type NDESInvalidError struct {
msg string
}
func (e NDESInvalidError) Error() string {
return e.msg
}
func NewNDESInvalidError(msg string) NDESInvalidError {
return NDESInvalidError{msg: msg}
}
type NDESPasswordCacheFullError struct {
msg string
}
func (e NDESPasswordCacheFullError) Error() string {
return e.msg
}
func NewNDESPasswordCacheFullError(msg string) NDESPasswordCacheFullError {
return NDESPasswordCacheFullError{msg: msg}
}
type NDESInsufficientPermissionsError struct {
msg string
}
func (e NDESInsufficientPermissionsError) Error() string {
return e.msg
}
func NewNDESInsufficientPermissionsError(msg string) NDESInsufficientPermissionsError {
return NDESInsufficientPermissionsError{msg: msg}
}