Skip to content

Commit

Permalink
Update MDS Code
Browse files Browse the repository at this point in the history
  • Loading branch information
ReneHaensel committed Jun 12, 2024
1 parent b73731b commit fe9a2fd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
5 changes: 5 additions & 0 deletions app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,11 @@ def publish_to_csh
end
identifier = JSON.parse(JSON.parse(endpoints.to_json)["endpoint"])["resource"]["identifier"]

em = @project.extended_metadata
jem = JSON.parse(em.json_metadata)
jem['Resource_identifier_Project'] = identifier
em.update_column(:json_metadata, jem.to_json)

flash[:notice] = "#{t('project')} was successfully published with ID #{identifier}."
respond_to do |format|
#@project.reload
Expand Down
34 changes: 17 additions & 17 deletions lib/nfdi4health/csh_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,53 +42,53 @@ def handle_restclient_error(e, name_server)
when 'get_token'
case e.response.code
when 400
'Bad Request: The server could not understand the request.'
'Token:CODE400- Bad Request: The server could not understand the request.'
when 401
'Unauthorized: Access is denied due to invalid credentials.'
'Token:CODE401- Unauthorized: Access is denied due to invalid credentials.'
when 403
'Forbidden: You do not have the necessary permissions to access this resource.'
'Token:CODE403- Forbidden: You do not have the necessary permissions to access this resource.'
when 404
'Not Found: The requested resource could not be found.'
'Token:CODE404- Not Found: The requested resource could not be found.'
when 500
'Internal Server Error: The server encountered an error and could not complete your request.'
'Token:CODE500- Internal Server Error: The server encountered an error and could not complete your request.'
else
"An unexpected error occurred: #{e.response}"
end
when 'send_transforming_api'
case e.response.code
when 400
'Bad Request: The server could not understand the request.'
'Transorm:CODE400- Bad Request: The server could not understand the request.'
when 401
'Unauthorized: Access is denied due to invalid credentials.'
'Transorm:CODE401- Unauthorized: Access is denied due to invalid credentials.'
when 403
'Forbidden: You do not have the necessary permissions to access this resource.'
'Transorm:CODE403- Forbidden: You do not have the necessary permissions to access this resource.'
when 404
'Not Found: The requested resource could not be found.'
'Transorm:CODE404- Not Found: The requested resource could not be found.'
when 500
'Internal Server Error: The server encountered an error and could not complete your request.'
'Transorm:CODE500- Internal Server Error: The server encountered an error and could not complete your request.'
else
"An unexpected error occurred: #{e.response}"
end
when 'publish_csh'
case e.response.code
when 200
'No new draft version created because uploaded resource contains no changes'
'pub_csh:CODE200- No new draft version created because uploaded resource contains no changes'
when 400
'Bad Request: The server could not understand the request.'
'pub_csh:CODE400- Bad Request: The server could not understand the request.'
when 401
'Not allowed to edit resource. User must either be the original creator of the resource or have been added as a collaborator.'
'pub_csh:CODE401- Not allowed to edit resource. User must either be the original creator of the resource or have been added as a collaborator.'
when 403
'Forbidden: You do not have the necessary permissions to access this resource.'
'pub_csh:CODE403- Forbidden: You do not have the necessary permissions to access this resource.'
when 404
'Not Found: The requested resource could not be found.'
'pub_csh:CODE404- Not Found: The requested resource could not be found.'
when 422
JSON.parse(JSON.parse(e.response.to_json)["message"])
when 500
'Internal Server Error: The server encountered an error and could not complete your request.'
'pub_csh:CODE500- Internal Server Error: The server encountered an error and could not complete your request.'
else
"An unexpected error occurred: #{e.response}"
end
end
end
end
end
end

0 comments on commit fe9a2fd

Please sign in to comment.