CLIP-HPC / goslmailer

GoSlurmMailer - drop in replacement for default slurm MailProg. Delivers slurm job messages to various destinations.
40 stars 6 forks source link

slurmjob: fix error handling throughout the package #7

Closed pja237 closed 2 years ago

pja237 commented 2 years ago

Example, these two log nothing in case of error, causing the app to "silently" end:

https://github.com/CLIP-HPC/goslmailer/blob/5189f278eae40b4a74117a0afe40ee20fb9520de/internal/slurmjob/sacct.go#L230 https://github.com/CLIP-HPC/goslmailer/blob/5189f278eae40b4a74117a0afe40ee20fb9520de/internal/slurmjob/sacct.go#L240

while at this, perhaps it would be better to change prototyping of the top calling method to return error back to main. Make the whole chain of calls below propagate err all the way back to main where it's handled (or log.Print + return err)

https://github.com/CLIP-HPC/goslmailer/blob/5189f278eae40b4a74117a0afe40ee20fb9520de/internal/slurmjob/getjobcontext.go#L125