hbp_nrp_backend package¶
This package contains the python code to run the REST web server and supportive tooling
-
exception
NRPServicesClientErrorException
(message, error_type='Client error', error_code=400, data=None)[source]¶ Bases:
hbp_nrp_backend.NRPServicesGeneralException
Exception class for client (4xx) errors. It can be used to return meaningful messages to the ExD frontend.
- Parameters
message – message displayed to the end user.
error_code – The HTTP error code to send to the frontend.
-
exception
NRPServicesDuplicateNameException
(message, error_type='Duplicate name error', error_code=403, data=None)[source]¶ Bases:
hbp_nrp_backend.NRPServicesGeneralException
Duplicate name exception that can be used to return meaningful messages to the HBP frontend in case simulation scripts (transfer-functions or state-machines) or populations contain duplicate names.
- Parameters
message – message displayed to the end user.
-
exception
NRPServicesGeneralException
(message, error_type, error_code=500, data=None)[source]¶ Bases:
Exception
General exception class that can be used to return meaningful messages to the ExD frontend.
- Parameters
message – message displayed to the end user.
error_type – Type of error (like ‘CLE Error’)
error_code – The HTTP error code to send to the frontend.
-
exception
NRPServicesStateException
(message, error_type='Transition error', error_code=400, data=None)[source]¶ Bases:
hbp_nrp_backend.NRPServicesGeneralException
State exception class that can be used to return meaningful messages to the HBP frontend.
- Parameters
message – message displayed to the end user.
-
exception
NRPServicesStateMachineException
(message, error_type='State machine error', error_code=400, data=None)[source]¶ Bases:
hbp_nrp_backend.NRPServicesClientErrorException
State machine exception class that can be used to return meaningful messages to the HBP frontend in case source code updates fail.
- Parameters
message – message displayed to the end user.
-
exception
NRPServicesTransferFunctionException
(message, error_type='Transfer function error', error_code=400, data=None)[source]¶ Bases:
hbp_nrp_backend.NRPServicesGeneralException
Transfer function exception class that can be used to return meaningful messages to the HBP frontend in case source code updates fail.
- Parameters
message – message displayed to the end user.
Bases:
hbp_nrp_backend.NRPServicesGeneralException
Server error with status 500 (internal error) issued when a ROS service is unavailable. It can be used to return meaningful messages to the ExD frontend.
- Parameters
message – message displayed to the end user. It contains the text of the corresponding ROS exception
-
exception
NRPServicesWrongUserException
[source]¶ Bases:
hbp_nrp_backend.NRPServicesClientErrorException
Exception class that can be used to return meaningful messages to the HBP frontend in case an invalid user is detected.
- Parameters
message – message displayed to the end user.
-
get_date_and_time_string
()[source]¶ Utility function that returns a string reflecting the current date and time with a format that is suitable for file or folder names
- Returns
a string containing the date and time under the format YYYY-mm-dd_HH-MM-SS