Skip to content

Commit 2617092

Browse files
authored
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 ace7785 commit 2617092

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
@@ -4375,6 +4375,9 @@ def slurm_update_reservation(dict reservation_dict={}):
43754375
resv_msg.flags = int_value
43764376

43774377
errCode = slurm.slurm_update_reservation(&resv_msg)
4378+
if errCode != 0:
4379+
apiError = slurm.slurm_get_errno()
4380+
raise ValueError(slurm.stringOrNone(slurm.slurm_strerror(apiError), ''), apiError)
43784381

43794382
return errCode
43804383

0 commit comments

Comments
 (0)