File tree Expand file tree Collapse file tree
ProcessMaker/Http/Controllers/Api Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace ProcessMaker \Http \Controllers \Api ;
4+
5+ use Illuminate \Http \Request ;
6+ use ProcessMaker \Http \Controllers \Controller ;
7+
8+ class DebugController extends Controller
9+ {
10+ public function store (Request $ request )
11+ {
12+ \Log::debug (
13+ "Unhandled Javascript API Error: " .
14+ str_limit ($ request ->getContent (), 100000 )
15+ );
16+ return response ('' , 204 );
17+ }
18+ }
Original file line number Diff line number Diff line change @@ -168,6 +168,12 @@ window.ProcessMaker.apiClient.interceptors.response.use((response) => {
168168 window . ProcessMaker . EventBus . $emit ( "api-client-error" , error ) ;
169169 if ( error . response && error . response . status && error . response . status === 401 ) {
170170 window . location = "/login" ;
171+ } else if ( ! error . config . url . match ( '/debug' ) ) {
172+ window . ProcessMaker . apiClient . post ( '/debug' , {
173+ message : error . message ,
174+ code : error . code ,
175+ config : error . config
176+ } )
171177 }
172178 return Promise . reject ( error ) ;
173179} ) ;
Original file line number Diff line number Diff line change 145145 Route::post ('comments ' , 'CommentController@store ' )->name ('comments.store ' )->middleware ('can:create-comments ' );
146146 Route::put ('comments/{comment} ' , 'CommentController@update ' )->name ('comments.update ' )->middleware ('can:edit-comments ' );
147147 Route::delete ('comments/{comment} ' , 'CommentController@destroy ' )->name ('comments.destroy ' )->middleware ('can:delete-comments ' );
148+
149+ // debugging javascript errors
150+ Route::post ('debug ' , 'DebugController@store ' )->name ('debug.store ' )->middleware ('throttle ' );
148151
149152 // Returns a json error message instead of HTML
150153 Route::fallback (function (){
You can’t perform that action at this time.
0 commit comments