Skip to content

Commit a47bb64

Browse files
pllopistazend
authored andcommitted
Raise ValueError on slurm_update_reservation (#257)
To be consistent with other functions and methods, we need to raise a ValueError instead of just returning the error code. This also allows client applications to more easily interpret the reason for the error.
1 parent df4e86c commit a47bb64

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pyslurm/pyslurm.pyx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4370,6 +4370,9 @@ def slurm_update_reservation(dict reservation_dict={}):
43704370
resv_msg.flags = int_value
43714371

43724372
errCode = slurm.slurm_update_reservation(&resv_msg)
4373+
if errCode != 0:
4374+
apiError = slurm.slurm_get_errno()
4375+
raise ValueError(slurm.stringOrNone(slurm.slurm_strerror(apiError), ''), apiError)
43734376

43744377
return errCode
43754378

0 commit comments

Comments
 (0)