File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ local M = {}
44--- @param err ErrorResponse
55--- @return string ?
66function M .fmt_error (err )
7- local body = err .body
7+ local body = err .body or {}
88 if body .error and body .error .showUser then
99 local msg = body .error .format
1010 for key , val in pairs (body .error .variables or {}) do
Original file line number Diff line number Diff line change 1+ local utils = require (' dap.utils' )
2+
13describe (' utils.index_of' , function ()
24 it (' returns index of first item where predicate matches' , function ()
35 local result = require (' dap.utils' ).index_of (
@@ -79,4 +81,11 @@ describe('utils.fmt_error', function ()
7981 }
8082 }))
8183 end )
84+
85+ it (' can handle response without body part' , function ()
86+ local result = utils .fmt_error ({
87+ message = ' Bad things happen' ,
88+ })
89+ assert .are .same (' Bad things happen' , result )
90+ end )
8291end )
You can’t perform that action at this time.
0 commit comments