You are able to add middleware(s) to a procedure with the t.procedure.use() method. The middleware(s) will wrap the invocation of the procedure and must pass through its return value.
error.cause
error.cause
if (!result.ok && result.error instanceof MyError) { ... }
if (!result.ok && result.error instanceof MyError) { ... }