Skip to content
This repository has been archived by the owner on Jan 17, 2025. It is now read-only.

Commit

Permalink
Ikke kast feilmelding videre om feilmeldingen er at det ikke er funne…
Browse files Browse the repository at this point in the history
…t noen lærer, men returner false så vi kan agere på det separat
  • Loading branch information
MatsAnd committed Jan 27, 2021
1 parent 8ec1583 commit 4ed15a6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/get-pifu-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ exports.getMyUser = async (caller) => {
return await getData(caller, '/me')
} catch (error) {
const { status, data } = error.response
if (status === 401 && /teacher not found/i.exec(data)) return false
throw new HTTPError(status || 500, data || 'Unknown error occured')
}
}
Expand All @@ -40,6 +41,7 @@ exports.getMyStudents = async (caller, contactStudents = false) => {
return students
} catch (error) {
const { status, data } = error.response
if (status === 403 && /teacher not found/i.exec(data)) return false
throw new HTTPError(status || 500, data || 'Unknown error occured')
}
}
Expand Down Expand Up @@ -78,6 +80,7 @@ exports.getMyClasses = async (caller) => {
return await getData(caller, '/me/classes')
} catch (error) {
const { status, data } = error.response
if (status === 403 && /teacher not found/i.exec(data)) return false
throw new HTTPError(status || 500, data || 'Unknown error occured')
}
}
Expand Down

0 comments on commit 4ed15a6

Please # to comment.