@@ -43,14 +43,14 @@ public function process(string $message): ?string
43
43
44
44
try {
45
45
$ message = $ this ->messageFactory ->create ($ message );
46
- } catch (\JsonException $ exception ) {
47
- $ this ->logger ->warning ('Failed to decode json message ' , ['exception ' => $ exception ]);
46
+ } catch (\JsonException $ e ) {
47
+ $ this ->logger ->warning ('Failed to decode json message ' , ['exception ' => $ e ]);
48
48
49
- return $ this ->encodeResponse (Error::parseError ($ exception ->getMessage ()));
50
- } catch (\InvalidArgumentException $ exception ) {
51
- $ this ->logger ->warning ('Failed to create message ' , ['exception ' => $ exception ]);
49
+ return $ this ->encodeResponse (Error::parseError ($ e ->getMessage ()));
50
+ } catch (\InvalidArgumentException $ e ) {
51
+ $ this ->logger ->warning ('Failed to create message ' , ['exception ' => $ e ]);
52
52
53
- return $ this ->encodeResponse (Error::invalidRequest (0 , $ exception ->getMessage ()));
53
+ return $ this ->encodeResponse (Error::invalidRequest (0 , $ e ->getMessage ()));
54
54
}
55
55
56
56
$ this ->logger ->info ('Decoded incoming message ' , ['message ' => $ message ]);
@@ -60,10 +60,10 @@ public function process(string $message): ?string
60
60
? $ this ->handleNotification ($ message ) : $ this ->encodeResponse ($ this ->handleRequest ($ message ));
61
61
} catch (\DomainException ) {
62
62
return null ;
63
- } catch (\InvalidArgumentException $ exception ) {
64
- $ this ->logger ->warning ('Failed to create response ' , ['exception ' => $ exception ]);
63
+ } catch (\InvalidArgumentException $ e ) {
64
+ $ this ->logger ->warning (sprintf ( 'Failed to create response: %s ' , $ e -> getMessage ()), ['exception ' => $ e ]);
65
65
66
- return $ this ->encodeResponse (Error::methodNotFound ($ message ->id ?? 0 , $ exception ->getMessage ()));
66
+ return $ this ->encodeResponse (Error::methodNotFound ($ message ->id ?? 0 , $ e ->getMessage ()));
67
67
}
68
68
}
69
69
0 commit comments