Skip to content

Error logger

xavier edited this page Aug 24, 2026 · 3 revisions

Error logger

You don't need to use a proxy to catch errors or print it/ handle it from the start to know the error message It logs only errors that aren't good responses from the car (like no connection is a normal response)

Terminal

Error is printed to terminal where the app is running:

Screenshot 2026-08-24 at 23 15 48
Exception: <it contains the response returned or exception that was raised>
Method: POST or GET
Headers: <headers in json format>
Query Params: <query in json format>
Body: <data in json format>

Log file

Logger logs errors into error_log.txt

syntax (I can say)

--------------------------------------------------
Error occurred during request: 
Timestamp: <time>
Method: POST or GET
Headers: <headers in json format>
Client: <info about the client>
Query Params: <query in json format>
Body: <data in json format>
JSON: <bool | True if the body was sent in VALID json format>
URL Encoded: <bool | True if the body was sent in url encoded>
Exception: <it contains the response returned or exception that was raised>

Example:

--------------------------------------------------
Error occurred during request: 
Timestamp: 2026-08-19 11:12:53.589259
Method: POST
Headers: {'host': 'testserver', 'accept': '*/*', 'accept-encoding': 'gzip, deflate', 'connection': 'keep-alive', 'user-agent': 'testclient', 'authorization': 'Basic VEVTVF9PQVVUSDpjbGllbnRfc2VjcmV0', 'content-length': '59', 'content-type': 'application/x-www-form-urlencoded'}
Client: Address(host='testclient', port=50000)
Query Params: {}
Body: {'code': '', 'grant_type': 'authorization_code', 'redirect_uri': 'test/url'}
JSON: False
URL Encoded: True
Exception: 400: {'error': {'message': 'BAD_REQUEST', 'description': 'No code available. Please request a new code'}}

--------------------------------------------------
Error occurred during request: 
Method: GET
Headers: {'host': '127.0.0.1:8000', 'user-agent': 'curl/8.7.1', 'accept': 'application/json', 'vcc-api-operationid': '3e514c99-ecbe-484c-b713-ece015504bb5'}
Client: Address(host='127.0.0.1', port=49575)
Query Params: {}
Body: b''
JSON: False
URL Encoded: False
Exception: 1 validation error:
  {'type': 'missing', 'loc': ('header', 'vcc-api-key'), 'msg': 'Field required', 'input': {'traceparent': '', 'vcc-api-operationId': '3e514c99-ecbe-484c-b713-ece015504bb5', 'authorization': '', 'Accept': 'application/json', 'host': '127.0.0.1:8000', 'user-agent': 'curl/8.7.1', 'accept': 'application/json', 'vcc-api-operationid': '3e514c99-ecbe-484c-b713-ece015504bb5'}}

  File "/Users/kl/volvo-playground/Volvo-API-playground/main.py", line 222, in listVehicles
    GET /vehicles


Clone this wiki locally