Skip to content

Commit

Permalink
feat: new PassageError
Browse files Browse the repository at this point in the history
  • Loading branch information
tdeshong committed Nov 21, 2024
1 parent bb1d22e commit b5f24cd
Show file tree
Hide file tree
Showing 7 changed files with 395 additions and 116 deletions.
8 changes: 1 addition & 7 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func New(appID string, config *Config) (*App, error) {

app.jwksCacheSet = jwk.NewCachedSet(cache, url)

app.User = newAppUser(app)
app.User = newAppUser(client, appID)

return &app, nil
}
Expand Down Expand Up @@ -107,19 +107,14 @@ func (a *App) CreateMagicLink(createMagicLinkBody CreateMagicLinkBody) (*MagicLi
}

var errorText string
var errorCode string
switch {
case res.JSON400 != nil:
errorCode = string(res.JSON400.Code)
errorText = res.JSON400.Error
case res.JSON401 != nil:
errorCode = string(res.JSON401.Code)
errorText = res.JSON401.Error
case res.JSON404 != nil:
errorCode = string(res.JSON404.Code)
errorText = res.JSON404.Error
case res.JSON500 != nil:
errorCode = string(res.JSON500.Code)
errorText = res.JSON500.Error
}

Expand All @@ -128,6 +123,5 @@ func (a *App) CreateMagicLink(createMagicLinkBody CreateMagicLinkBody) (*MagicLi
StatusCode: res.StatusCode(),
StatusText: res.Status(),
ErrorText: errorText,
ErrorCode: errorCode,
}
}
Loading

0 comments on commit b5f24cd

Please sign in to comment.