Skip to content

Commit

Permalink
Merge pull request #178 from mdenet:fix/correctly-report-activity-acc…
Browse files Browse the repository at this point in the history
…ess-issues

Correctly report activity access issues
  • Loading branch information
szschaler authored Feb 14, 2024
2 parents 2c58019 + c65cb90 commit 4f6b477
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
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,
success: false,
});
} else {
Expand Down

0 comments on commit 4f6b477

Please sign in to comment.