-
Notifications
You must be signed in to change notification settings - Fork 2
Description
User Story
As a developer using the SDK, I want the SDK.mediaConnector.download
function type signature to match behavior so that my application's type checking and error handling are accurate and predictable.
Issue Description
The SDK.mediaConnector.download
function is typed to return Promise<Uint8Array>
. However, when an error occurs (e.g., an invalid connector ID is provided), the function does not throw an error or return a Uint8Array
. Instead, it returns an EditorResponse
object, which is an unexpected return type that bypasses expected error handling mechanisms and leads to type mismatches in consuming code.
Steps to Reproduce
Call SDK.mediaConnector.download
with a valid mediaId
, and downloadType
. but a non-existent connector in id
.
You will get
{
"success": false,
"status": 401047,
"data": "null",
"error": "Connector container with id 2e986109-b2a4-4f80-84dd-30e6a5aaf375 not found! Configuration is not initialized."
}
Expected Behavior
The SDK.mediaConnector.download
function should either:
a) Throw a descriptive error when an issue occurs during the download process.
OR
b) Wrap the Uint8Array
in an EditorResponse
and return Promise<EditorResponse<Uint8Array>>
consistently, aligning the return type with the actual behavior.
Actual Behavior
When SDK.mediaConnector.download
fails due to an invalid connector ID, it returns an EditorResponse
object with success: false
, which is not consistent with the declared return type of Promise<Uint8Array>
.
I did not check other possible error states.
Additional Context
The current behavior leads to unexpected runtime errors and makes it difficult for developers to rely on the function's type signature for error handling and data processing.
See: #597