diff --git a/lib/get-pifu-data.js b/lib/get-pifu-data.js index e9ad81b..f9e51da 100644 --- a/lib/get-pifu-data.js +++ b/lib/get-pifu-data.js @@ -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') } } @@ -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') } } @@ -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') } }