xlab-si / xopera-opera

xOpera orchestrator compliant with TOSCA YAML v1.3 in the making
https://xlab-si.github.io/xopera-docs/
Apache License 2.0
35 stars 14 forks source link

Use different return codes for different types of errors #141

Open anzoman opened 3 years ago

anzoman commented 3 years ago

Description

Having different return codes for different types of errors could help users and developers indicate what error they are dealing with. This could be also useful for xOpera API and xOpera SaaS API to return better responses for the end users.

As things are now, we always return the code 1 regardless of error type. Opera has three main exception types (located in src/opera/error.py):

I propose return codes 1, 2 and 3 for these and 4 for other exceptions.

Steps

To realize this we should update the return codes in all python files to be consistent.

Current behaviour

Right now opera uses only one return code for errors (1).

Expected results

To have different return codes for different types of errors (1, 2, 3, 4).