Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly report activity access issues #178

Merged
merged 2 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions platform/src/ActivityManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,12 @@ class ActivityManager {
let errors = [];
let fileContent

try{
try {
let file = this.fileHandler.fetchFile( this.activitiesUrl , urlParamPrivateRepo() );
fileContent = file.content;
} catch (e) {
if (e instanceof DOMException){
errors.push( new EducationPlatformError(`The activity configuration file was not accessible at: ${this.activitiesUrl}.
Check the activity file is available at the given url.`) );
}
errors.push( new EducationPlatformError(`The activity configuration file was not accessible at: ${this.activitiesUrl}.
Check the activity file is available at the given url and you have the correct access rights.`) );
}

if (fileContent != null){
Expand Down
4 changes: 2 additions & 2 deletions tokenserver/src/middleware/ErrorHandlingMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

const errorHandlingMiddleware = (err, req, res, next) => {
if (err.status != null) {
res.status(err.statusCode).json({
msg: err.message,
res.status(err.status).json({
msg: err.response.data.message,
barnettwilliam marked this conversation as resolved.
Show resolved Hide resolved
success: false,
});
} else {
Expand Down
Loading