fix: checking for error types
This commit is contained in:
parent
5cf263a86f
commit
ac6818a476
2 changed files with 4 additions and 2 deletions
|
@ -137,7 +137,8 @@ func (f *File) Delete() (err error) {
|
||||||
|
|
||||||
err = afs.Remove(f.getFileName())
|
err = afs.Remove(f.getFileName())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, &os.PathError{}) {
|
var perr *os.PathError
|
||||||
|
if errors.As(err, &perr) {
|
||||||
// Don't fail when removing the file failed
|
// Don't fail when removing the file failed
|
||||||
log.Errorf("Error deleting file %d: %w", err)
|
log.Errorf("Error deleting file %d: %w", err)
|
||||||
return s.Commit()
|
return s.Commit()
|
||||||
|
|
|
@ -156,7 +156,8 @@ func NewEcho() *echo.Echo {
|
||||||
|
|
||||||
e.HTTPErrorHandler = func(err error, c echo.Context) {
|
e.HTTPErrorHandler = func(err error, c echo.Context) {
|
||||||
// Only capture errors not already handled by echo
|
// Only capture errors not already handled by echo
|
||||||
if errors.Is(err, &echo.HTTPError{}) {
|
var herr *echo.HTTPError
|
||||||
|
if errors.As(err, &herr) {
|
||||||
hub := sentryecho.GetHubFromContext(c)
|
hub := sentryecho.GetHubFromContext(c)
|
||||||
if hub != nil {
|
if hub != nil {
|
||||||
hub.WithScope(func(scope *sentry.Scope) {
|
hub.WithScope(func(scope *sentry.Scope) {
|
||||||
|
|
Loading…
Reference in a new issue