Skip to content

Add detail and message fields to traceback on status failed #136

@amarcozzi

Description

@amarcozzi

A resource which reached a status failed with helpful information about why it failed looks like this:

{
  "tree": {
    "checksum": "47a35bc4ec0e424ea1decdf4697003cd",
    "domainId": "66d9a7d7cbd24320a3fa7b2654d401b8",
    "createdOn": "2025-10-29T20:35:09.247961+00:00",
    "modifiedOn": "2025-10-29T20:35:23.924125+00:00",
    "file": {
      "error": {
        "code": "SCHEMA_VALIDATION_ERROR",
        "details": "Column 'CR' failed element-wise validator number 0: Crown ratio must be between 0 and 1 failure cases: 4.979259468965165, 4.970855711461264, 4.953846329319697, 4.924230620126946, 4.910414550242519, 4.877267699389302, 4.785408445853443, 4.743844994157598, 4.665358948739675, 4.654538065411702, 4.6473233740287245, 4.614057159683608, 4.5306875260933, 4.511822792384851, 4.480239125588236, 4.47725860942162, 4.474687268981393, 4.447458167915727, 4.441460280294024, 4.429700721131098, 4.357658142857929, 4.350035336404329, 4.339217491942731, 4.336413212687449, 4.301141528987307, 4.214224046540369, 4.211059145738853, 4.195913561238205, 4.174305667869794, 4.1578251163917965, 4.139914720732895, 4.137080805020304, 3.3448549318534107, 3.3387198184535465, 3.239930901412367, 3.232680573849882, 3.1809351899974105, 3.176475490470466, 3.175436706705568, 3.1669901762128347, 3.1012420580061475, 3.0888974263883937, 3.06934904910604, 3.063230072712673, 3.0537175642733474, 3.034805049105421, 3.031388837706436, 3.01573300835027, 3.0035924315243734, 2.9963343665094957, 2.978378591163158, 2.9764786435935946, 2.9666882773616408, 2.965440445866045, 2.9597784507102234, 2.957477127917969, 2.942471860324747, 2.934846891303221, 2.9290415810642, 2.8545329324685325, 2.854526764793468, 2.80955488026878, 2.8058540670743697, 2.802410734966867, 2.8007158799802823, 3.066044258207325, 2.9474919923076595, 3.0238043262898517, 3.003770544917658, 4.131116451049446, 3.2726279008572896, 3.038392018469112, 4.122008600933336, 2.820097535708185, 4.256596943653172, 3.0973907917828867, 3.032683140938821, 4.1618863576800695, 1.0724019429884568, 1.0007158608955005",
        "suggestions": "Check that your CSV file has the required columns (SPCD, STATUSCD, DIA, HT, CR, X, Y) with correct data types and value ranges",
        "message": "CSV data validation failed"
      },
      "message": "CSV data validation failed"
    },
    "featureMasks": [],
    "status": "failed",
    "modifications": [],
    "sources": [
      "file"
    ],
    "treatments": []
  }
}

However, the traceback only gives the user this information:

Tree inventory has status `JobStatus.PENDING` (1.00s)
Tree inventory has status `JobStatus.PENDING` (2.00s)
Tree inventory has status `JobStatus.PENDING` (3.00s)
Tree inventory has status `JobStatus.PENDING` (4.00s)
Tree inventory has status `JobStatus.PENDING` (5.00s)
Tree inventory has status `JobStatus.PENDING` (6.00s)
Tree inventory has status `JobStatus.PENDING` (7.00s)
Tree inventory has status `JobStatus.RUNNING` (8.00s)
Tree inventory has status `JobStatus.FAILED` (9.00s)
Traceback (most recent call last):
  File "/Users/leticia/Documents/Code/git/site_specific_fuels/als_treetops_to_treelist_ml.py", line 1090, in <module>
    tree_inventory.wait_until_completed(step = 1, verbose = True)
  File "/opt/anaconda3/envs/gdal_env3/lib/python3.12/site-packages/fastfuels_sdk/inventories.py", line 835, in wait_until_completed
    raise RuntimeError("Tree inventory processing failed.")
RuntimeError: Tree inventory processing failed.

We need to supply the information in the error field with the detail and message to the traceback when that field is available.

Metadata

Metadata

Assignees

Labels

✨ featureNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions