Skip to content

Commit

Permalink
fix(storage-client): remove all null as value
Browse files Browse the repository at this point in the history
  • Loading branch information
AliMD committed Nov 17, 2022
1 parent 9a982eb commit 6fbc6e5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/core/storage-client/src/storage-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ alwatrRegisteredList.push({
* ```
*/
export class AlwatrStorageClient<DocumentType extends DocumentObject> {
protected _logger = createLogger(`alwatr-storage-client:${this.config.name}`, undefined);
protected _logger = createLogger('alwatr-storage-client:' + this.config.name, undefined, this.config.debug);

constructor(public readonly config: AlwatrStorageClientConfig) {
if (!(config.host[config.host.length - 1] === '/')) {
Expand All @@ -88,7 +88,7 @@ export class AlwatrStorageClient<DocumentType extends DocumentObject> {
* const user = await userStorage.get('user-1');
* ```
*/
async get(documentId: string): Promise<DocumentType | null> {
async get(documentId: string): Promise<DocumentType> {
const response = await fetch({
url: this.config.host,
queryParameters: {
Expand All @@ -113,7 +113,7 @@ export class AlwatrStorageClient<DocumentType extends DocumentObject> {
return content.data;
}
else if (content.ok === false && content.errorCode === 'document_not_found') {
return null;
throw new Error('document_not_found');
}
else {
throw new Error('fetch_failed');
Expand All @@ -134,7 +134,7 @@ export class AlwatrStorageClient<DocumentType extends DocumentObject> {
* });
* ```
*/
async set(documentObject: DocumentType): Promise<DocumentType | null> {
async set(documentObject: DocumentType): Promise<DocumentType> {
const response = await fetch({
url: this.config.host,
method: 'PATCH',
Expand Down

0 comments on commit 6fbc6e5

Please sign in to comment.