ai 3.1.5 → 3.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -53,7 +53,15 @@ function convertDataContentToUint8Array(content) {
53
53
  return content;
54
54
  }
55
55
  if (typeof content === "string") {
56
- return convertBase64ToUint8Array(content);
56
+ try {
57
+ return convertBase64ToUint8Array(content);
58
+ } catch (error) {
59
+ throw new InvalidDataContentError({
60
+ message: "Invalid data content. Content string is not a base64-encoded image.",
61
+ content,
62
+ cause: error
63
+ });
64
+ }
57
65
  }
58
66
  if (content instanceof ArrayBuffer) {
59
67
  return new Uint8Array(content);