Skip to content

Commit

Permalink
fix: (hopefully the last). Errors don't need to be recreated since th…
Browse files Browse the repository at this point in the history
…ey bubble up as full errors
  • Loading branch information
kiwicopple committed Oct 15, 2020
1 parent 28cda7b commit 4aebf50
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default class Client {
credentials.email,
credentials.password
)
if (error) throw new Error(error)
if (error) throw error

if (data?.user?.confirmed_at) {
this._saveSession(data)
Expand Down Expand Up @@ -110,7 +110,7 @@ export default class Client {
if (!this.currentSession?.access_token) throw new Error('Not logged in.')

let { data, error }: any = await this.api.getUser(this.currentSession.access_token)
if (error) throw new Error(error)
if (error) throw error

this.currentUser = data
return { data: this.currentUser, error: null }
Expand All @@ -130,7 +130,7 @@ export default class Client {
this.currentSession.access_token,
attributes
)
if (error) throw new Error(error)
if (error) throw error

this.currentUser = data
this._notifyAllSubscribers(AuthChangeEvent.USER_UPDATED)
Expand Down Expand Up @@ -162,7 +162,7 @@ export default class Client {
if (!token_type) throw new Error('No token_type detected.')

let { data: user, error }: any = await this.api.getUser(access_token)
if (error) throw new Error(error)
if (error) throw error

const session: Session = {
access_token,
Expand Down

0 comments on commit 4aebf50

Please sign in to comment.