1
0
mirror of https://github.com/sasjs/server.git synced 2026-07-23 21:25:29 +00:00
Commit Graph

34 Commits

Author SHA1 Message Date
YuryShkoda 850695024f fix(api): return 200 with embedded log on SAS session failure instead of 400
A failed session (e.g. SAS %abort;, or a non-zero JS/PY/R exit) is a
normal outcome of running arbitrary user code, not a request-shape or
server problem. The #388 fix stopped processProgram() from hanging
forever on a failed SAS session, but did so by throwing a
SessionExecutionError, which surfaced as an HTTP 400 with a bespoke
JSON shape - breaking Studio's log tab, which only renders on 2xx.

Align the SAS branch with the pre-existing JS/PY/R behaviour: resolve
instead of throwing, and let Execution.ts fold session.failureReason
into the log the same way it already does for a debug-mode run. This
removes the now-dead SessionExecutionError class and its try/catch
wrapper entirely.

Update the diagrams in api/docs/diagrams/ to match.
2026-07-15 13:59:01 +03:00
YuryShkoda f84af4ac06 fix(api): return prompt error response instead of hanging when a SAS session fails
The SAS-runtime poll loop in processProgram only checked for
SessionState.completed, so a session that failed (e.g. via %abort;)
left the loop spinning on delay(50) forever - the request never
resolved, even though the SAS log had already been written. Split a single completed-on-either-outcome
flag into separate completed/failed states without updating this loop.

- processProgram now throws when session.state becomes 'failed'
- Execution.ts catches that, reads the complete log (guaranteed
  complete since the session's process has already exited by then),
  and throws a SessionExecutionError carrying it
- stp.ts/code.ts surface { ..., log } in the HTTP error response
- add unit tests for the poll loop and the log-enrichment logic, plus
  a mock SAS executable + end-to-end test exercising the real
  session/process pipeline without needing a SAS install
- add docs/diagrams covering the session lifecycle and the SAS
  execution handshake mechanism, for future context
2026-07-13 13:46:36 +03:00
Yury bc2cff1d0d chore(api): updated trigger endpoints description 2024-10-31 15:30:32 +03:00
Yury 66aa9b5891 chore(api): updated trigger endpoints description 2024-10-31 15:20:35 +03:00
Yury 03670cf0d6 chore(swagger): fixed code/stp trigger examples 2024-10-30 15:25:03 +03:00
Yury e9519cb3c6 chore(code): used correct type 2024-10-29 16:20:27 +03:00
Yury 049a7f4b80 chore(swagger): improved description 2024-10-29 12:02:26 +03:00
Yury ffcf193b87 feat(code): added code/trigger API endpoint 2024-10-29 11:18:04 +03:00
Yury Shkoda 958ab9cad2 chore(execution): add includePrintOutput to ExecuteFileParams 2023-05-03 10:46:21 +03:00
Yury Shkoda 78ceed13e1 docs(code): updated execute endpoint info 2023-05-02 16:01:00 +03:00
Yury Shkoda 9aaffce820 fix(execute): fixed adding print output 2023-05-02 15:49:44 +03:00
Yury Shkoda bd1b58086d docs: left a comment regarding payload parts 2023-05-02 12:10:17 +03:00
munja a810f6c7cf chore(docs): updating swagger definitions 2022-09-21 11:08:12 +01:00
munja 1092a73c10 chore(docs): updating API docs 2022-09-20 12:20:50 +01:00
sabhas 98ea2ac9b9 fix: update response of /SASjsApi/stp/execute and /SASjsApi/code/execute 2022-08-19 15:06:39 +05:00
Saad Jutt b1a0fe7060 chore: code fixes 2022-06-19 18:35:10 +05:00
sabhas 23b6692f02 fix: code/execute controller logic to handle different runtimes 2022-06-17 20:01:50 +05:00
Saad Jutt 81501d17ab chore: code fixes 2022-06-15 16:03:04 +05:00
sabhas e5a7674fa1 chore: refactor ExecutionController class to remove code duplications 2022-06-06 09:09:21 +05:00
sabhas c58666eb81 fix: convert single executeProgram method to two methods i.e. executeSASProgram and executeJSProgram 2022-06-03 17:26:21 +05:00
Saad Jutt 2c259fe1de fix(web): ability to use get/patch User API in desktop mode. 2022-05-27 17:01:14 +05:00
Saad Jutt 79dc2dba23 fix(autoexec): usage in case of desktop from file 2022-05-25 10:44:57 +05:00
Saad Jutt 2a7223ad7d feat(api): added autoexec + major type setting changes 2022-05-24 21:12:32 +05:00
Saad Jutt 636301e664 fix: reqHeadrs.txt will contain headers to access APIs 2022-05-08 02:49:16 +05:00
Saad Jutt 5005f203b8 fix(stp): return json for webout 2022-02-21 04:13:04 +05:00
Saad Jutt ef41691e40 fix(file): fixes response headers 2022-02-20 06:18:44 +05:00
Saad Jutt 3e6234e601 fix: return buffer in case of file response 2022-02-20 05:40:03 +05:00
Saad Jutt c5ad72c931 feat: parse log to array 2022-02-20 04:50:09 +05:00
Saad Jutt e2a6810e95 fix: code api is updated return type 2022-02-20 02:57:45 +05:00
Saad Jutt 0b5f958f45 fix: minor changes 2022-02-18 08:03:01 +05:00
Saad Jutt da899b90e2 fix: added http headers to /code api as well 2022-02-18 07:25:48 +05:00
Saad Jutt 2c4aa420b3 feat: set response headers provded by SAS Code execution 2022-02-18 07:22:11 +05:00
Saad Jutt 679e9de245 chore: return webout and log seperately 2021-12-29 00:27:54 +05:00
Saad Jutt e6e5a5fd64 chore(code): updated route to code/execute 2021-12-21 14:24:27 +05:00