Skip to content

Commit 0c48ae3

Browse files
mgr/smb: improve error handling for generic exceptions
Ensure that something gets added to the error response even if the caught exception has no associated text. Signed-off-by: John Mulligan <[email protected]>
1 parent 96b9564 commit 0c48ae3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/pybind/mgr/smb/handler.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,11 @@ def apply(
369369
results.append(err)
370370
except Exception as err:
371371
log.exception("error updating resource")
372-
result = ErrorResult(resource, msg=str(err))
372+
msg = str(err)
373+
if not msg:
374+
# handle the case where the exception has no text
375+
msg = f"error updating resource: {type(err)} (see logs for details)"
376+
result = ErrorResult(resource, msg=msg)
373377
results.append(result)
374378
if results.success:
375379
log.debug(

0 commit comments

Comments
 (0)