@@ -43,14 +43,14 @@ func (c *Controller) runSQL(ctx context.Context, request *ExecuteCodeRequest) er
4343 request .Hooks .OnExecuteInit (uuid .New ().String ())
4444 err := c .initDB ()
4545 if err != nil {
46- request .Hooks .OnExecuteError (& execute.ErrorOutput {EName : "DBInitError" , EValue : err .Error ()})
46+ request .Hooks .OnExecuteError (& execute.ErrorOutput {EName : "DBInitError" , EValue : err .Error (), ExitCode : 255 })
4747 log .Error ("DBInitError: error initializing db server: %v" , err )
4848 return err
4949 }
5050
5151 err = c .db .PingContext (ctx )
5252 if err != nil {
53- request .Hooks .OnExecuteError (& execute.ErrorOutput {EName : "DBPingError" , EValue : err .Error ()})
53+ request .Hooks .OnExecuteError (& execute.ErrorOutput {EName : "DBPingError" , EValue : err .Error (), ExitCode : 255 })
5454 log .Error ("DBPingError: error pinging db server: %v" , err )
5555 return err
5656 }
@@ -69,14 +69,14 @@ func (c *Controller) executeSelectSQLQuery(ctx context.Context, request *Execute
6969
7070 rows , err := c .db .QueryContext (ctx , request .Code )
7171 if err != nil {
72- request .Hooks .OnExecuteError (& execute.ErrorOutput {EName : "DBQueryError" , EValue : err .Error ()})
72+ request .Hooks .OnExecuteError (& execute.ErrorOutput {EName : "DBQueryError" , EValue : err .Error (), ExitCode : 255 })
7373 return nil
7474 }
7575 defer rows .Close ()
7676
7777 columns , err := rows .Columns ()
7878 if err != nil {
79- request .Hooks .OnExecuteError (& execute.ErrorOutput {EName : "DBQueryError" , EValue : err .Error ()})
79+ request .Hooks .OnExecuteError (& execute.ErrorOutput {EName : "DBQueryError" , EValue : err .Error (), ExitCode : 255 })
8080 return nil
8181 }
8282
@@ -90,7 +90,7 @@ func (c *Controller) executeSelectSQLQuery(ctx context.Context, request *Execute
9090 for rows .Next () {
9191 err := rows .Scan (scanArgs ... )
9292 if err != nil {
93- request .Hooks .OnExecuteError (& execute.ErrorOutput {EName : "RowScanError" , EValue : err .Error ()})
93+ request .Hooks .OnExecuteError (& execute.ErrorOutput {EName : "RowScanError" , EValue : err .Error (), ExitCode : 255 })
9494 return nil
9595 }
9696 row := make ([]any , len (columns ))
@@ -104,7 +104,7 @@ func (c *Controller) executeSelectSQLQuery(ctx context.Context, request *Execute
104104 result = append (result , row )
105105 }
106106 if err := rows .Err (); err != nil {
107- request .Hooks .OnExecuteError (& execute.ErrorOutput {EName : "RowIterationError" , EValue : err .Error ()})
107+ request .Hooks .OnExecuteError (& execute.ErrorOutput {EName : "RowIterationError" , EValue : err .Error (), ExitCode : 255 })
108108 return nil
109109 }
110110
@@ -114,7 +114,7 @@ func (c *Controller) executeSelectSQLQuery(ctx context.Context, request *Execute
114114 }
115115 bytes , err := json .Marshal (queryResult )
116116 if err != nil {
117- request .Hooks .OnExecuteError (& execute.ErrorOutput {EName : "JSONMarshalError" , EValue : err .Error ()})
117+ request .Hooks .OnExecuteError (& execute.ErrorOutput {EName : "JSONMarshalError" , EValue : err .Error (), ExitCode : 255 })
118118 return nil
119119 }
120120 request .Hooks .OnExecuteResult (
@@ -133,7 +133,7 @@ func (c *Controller) executeUpdateSQLQuery(ctx context.Context, request *Execute
133133
134134 result , err := c .db .ExecContext (ctx , request .Code )
135135 if err != nil {
136- request .Hooks .OnExecuteError (& execute.ErrorOutput {EName : "DBExecError" , EValue : err .Error ()})
136+ request .Hooks .OnExecuteError (& execute.ErrorOutput {EName : "DBExecError" , EValue : err .Error (), ExitCode : 255 })
137137 return err
138138 }
139139
@@ -144,7 +144,7 @@ func (c *Controller) executeUpdateSQLQuery(ctx context.Context, request *Execute
144144 }
145145 bytes , err := json .Marshal (queryResult )
146146 if err != nil {
147- request .Hooks .OnExecuteError (& execute.ErrorOutput {EName : "JSONMarshalError" , EValue : err .Error ()})
147+ request .Hooks .OnExecuteError (& execute.ErrorOutput {EName : "JSONMarshalError" , EValue : err .Error (), ExitCode : 255 })
148148 return err
149149 }
150150 request .Hooks .OnExecuteResult (
0 commit comments