Skip to content

Commit 18d088c

Browse files
authored
added export empty relation error (#104)
* added export empty size error * bump version * changed changelog desc and renamed error class
1 parent 10276aa commit 18d088c

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## v0.7.7-alpha
4+
5+
- Exported EmptyRelationError
6+
37
## v0.7.6-alpha
48

59
- Added an error to handle empty relation size of 0 bytes when reading arrow files

index.web.ts

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export type { SdkError } from './src/errors';
2626
export {
2727
AbortError,
2828
ApiError,
29+
EmptyRelationError,
2930
MaxRelationSizeError,
3031
TransactionError,
3132
} from './src/errors';

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@relationalai/rai-sdk-javascript",
33
"description": "RelationalAI SDK for JavaScript",
4-
"version": "0.7.6-alpha",
4+
"version": "0.7.7-alpha",
55
"author": {
66
"name": "RelationalAI",
77
"url": "https://relational.ai"

src/api/transaction/transactionUtils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import { tableFromIPC } from 'apache-arrow';
1818

19-
import { EmptyRelationSizeError, MaxRelationSizeError } from '../../errors';
19+
import { EmptyRelationError, MaxRelationSizeError } from '../../errors';
2020
import { MetadataInfo } from '../../proto/generated/message';
2121
import { RelationId } from '../../proto/generated/schema';
2222
import {
@@ -96,7 +96,7 @@ export async function readArrowFiles(files: TransactionAsyncFile[]) {
9696
// all the remaining parts are empty as well in Windows’s Chrome,
9797
// therefore, throwing the error here to avoid failures downstream
9898
if (file.file.size === 0) {
99-
throw new EmptyRelationSizeError(file.name);
99+
throw new EmptyRelationError(file.name);
100100
}
101101

102102
const table = await tableFromIPC(file.file.stream());

src/errors.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ export class MaxRelationSizeError extends Error {
8282
}
8383
}
8484

85-
export class EmptyRelationSizeError extends Error {
85+
export class EmptyRelationError extends Error {
8686
constructor(public relationId: string) {
87-
const message = `Empty relation size of 0 bytes. Relation: ${relationId}`;
87+
const message = `Unexpected 0 bytes relation. Relation: ${relationId}`;
8888

8989
super(message);
9090

91-
this.name = 'EmptyRelationSizeError';
91+
this.name = 'EmptyRelationError';
9292
}
9393
}
9494

@@ -109,5 +109,5 @@ export type SdkError =
109109
| ApiError
110110
| TransactionError
111111
| MaxRelationSizeError
112-
| EmptyRelationSizeError
112+
| EmptyRelationError
113113
| Error;

0 commit comments

Comments
 (0)