`PyError.message` contains the full log: all `orReturn("some text")` messages.
While they help user sometimes, some of them duplicate otuput and mustn't be displayed two times.
GitOrigin-RevId: 9a726cfcc8cb6b23825adc5d7dd505e1b8afd9c2
Use `ExecService` `api.kt` to exec any binary and extensions from `execService.python/api.kt` for python-specific things (i.e helpers)
GitOrigin-RevId: bb217798a9d1ee886c4b12220ec1f66a5ef08336
* introduce PyResult.localizedError() (instead of failure()
* get rid of obsolete kotlin.Result.failure(..) extension
* add errorOrNull to python.Result, to access it from Java classes
Merge-request: IJ-MR-163973
Merged-by: Vitaly Legchilkin <Vitaly.Legchilkin@jetbrains.com>
GitOrigin-RevId: 2bd8336cf4c53170eea5d050f609fd64541ebd99
1. `ProcessOutput` is a legacy thing with some redundant flags: replaced with modern `EelProcessExecutionResult`.
2. There was a bug in `ProcessInteractiveHandler`: one could fetch all data from stdout, and we then did that again to get a result. That leads to an empty result. It is now fixed, see `executeInteractive` doc.
GitOrigin-RevId: 7fa57f8110a202a32a3531ff6507d42a270075a3
DO:
For upper-level (public) API use `PyResult`.
(Optionally) for low-level APIs inside your modules use python `Result<S, E>`.
Represent errors as `PyError` whenever possible.
Report `PyError` to `ErrorSink` at the top of your code.
DON'T:
Use `kotlin.Result`
Use `PyExecutionException`
Use any exception to represent user errors.
GitOrigin-RevId: 4ecf69e1fae8be9192cd33b90e0147c725a98964
+ replace processDescription and timeout fields with ExecOptions
+ add workingDirectory and env variables to exec options
+ support ProcessOutputTransformer for cases when both stdout/stderr and custom error handling is needed
+ make PyError classes open to have custom business errors
GitOrigin-RevId: 99c969e730cdbf23df4c9b176a43f78ede43001a
No need to have a separate class
Signed-off-by: Ilya.Kazakevich <ilya.kazakevich@jetbrains.com>
GitOrigin-RevId: 9af33f30bbab9a85609c0c6536cb3120347fa20b
`com.jetbrains.python.Result<Something, PyError>` is supported by `com/jetbrains/python/util/ErrorSink.kt`
The idea: if your function executes some external command, return an error as the aforementioned class. `ErrorSink` will display it nicely.
GitOrigin-RevId: d8a7d6997a9aded91691dbb531c3d4286de85f15
There were three problems:
1.
There was `PyExecutionException` with an optional message which was intended to be displayed via dialog using a message as a title.
It breaks an exception contract (code that isn't aware of this particular class should still be able to fetch info, and a message is usually blank).
2.
Moreover, `ErrorSink` wasn't aware of it either and displayed it as a plain text.
3.
`PyExecutionException` didn't distinguish between "process can't be started" and "process died with error code != 0". Those are different cases.
This change:
1. Fixes `PyExecutionException` for 1 and 3.
2. Introduces API in `ErrorSink.kt` to display `PyExecutionException`
GitOrigin-RevId: a8d835afb086b23c73ced15f243d2b27b59dcf82