Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the responds status code for not implemented API from 500 to 501 #2517

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## Upcoming Release

General:

- Changed the responds status code of not implemented API from 500 to 501.

Blob:

- GetBlob on Archive tier blobs now fails as expected.
Expand Down
20 changes: 19 additions & 1 deletion src/blob/errors/NotImplementedError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,28 @@ import StorageError from "./StorageError";
export default class NotImplementedError extends StorageError {
public constructor(requestID: string = "") {
super(
500,
501,
"APINotImplemented",
"Current API is not implemented yet. Please vote your wanted features to https://github.com/azure/azurite/issues",
requestID
);
}
}

/**
* Create customized error types by inheriting ServerError
*
* @export
* @class UnimplementedError
* @extends {StorageError}
*/
export class NotImplementedinSQLError extends StorageError {
public constructor(requestID: string = "") {
super(
501,
"APINotImplemented",
"Current API is not implemented yet when use a SQL database based metadata storage. Please vote your wanted features to https://github.com/azure/azurite/issues",
requestID
);
}
}
17 changes: 9 additions & 8 deletions src/blob/persistence/SqlBlobMetadataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import PageWithDelimiter from "./PageWithDelimiter";
import FilterBlobPage from "./FilterBlobPage";
import { getBlobTagsCount, getTagsFromString, toBlobTags } from "../utils/utils";
import { generateQueryBlobWithTagsWhereFunction } from "./QueryInterpreter/QueryInterpreter";
import { NotImplementedinSQLError } from "../errors/NotImplementedError";

// tslint:disable: max-classes-per-file
class ServicesModel extends Model { }
Expand Down Expand Up @@ -1831,7 +1832,7 @@ export default class SqlBlobMetadataStore implements IBlobMetadataStore {
}

public undeleteBlob(): Promise<void> {
throw new Error("Method not implemented.");
throw new NotImplementedinSQLError();
}

public async createSnapshot(
Expand Down Expand Up @@ -2756,7 +2757,7 @@ export default class SqlBlobMetadataStore implements IBlobMetadataStore {
copySource: string,
metadata: Models.BlobMetadata | undefined
): Promise<Models.BlobPropertiesInternal> {
throw new Error("Method not implemented.");
throw new NotImplementedinSQLError(context.contextId);
}

public setTier(
Expand Down Expand Up @@ -2866,7 +2867,7 @@ export default class SqlBlobMetadataStore implements IBlobMetadataStore {
leaseAccessConditions?: Models.LeaseAccessConditions,
modifiedAccessConditions?: Models.ModifiedAccessConditions
): Promise<Models.BlobPropertiesInternal> {
throw new Error("Method not implemented.");
throw new NotImplementedinSQLError(context.contextId);
}

public clearRange(
Expand All @@ -2877,7 +2878,7 @@ export default class SqlBlobMetadataStore implements IBlobMetadataStore {
leaseAccessConditions?: Models.LeaseAccessConditions,
modifiedAccessConditions?: Models.ModifiedAccessConditions
): Promise<Models.BlobPropertiesInternal> {
throw new Error("Method not implemented.");
throw new NotImplementedinSQLError(context.contextId);
}

public getPageRanges(
Expand All @@ -2889,7 +2890,7 @@ export default class SqlBlobMetadataStore implements IBlobMetadataStore {
leaseAccessConditions?: Models.LeaseAccessConditions,
modifiedAccessConditions?: Models.ModifiedAccessConditions
): Promise<GetPageRangeResponse> {
throw new Error("Method not implemented.");
throw new NotImplementedinSQLError(context.contextId);
}

public resizePageBlob(
Expand All @@ -2901,7 +2902,7 @@ export default class SqlBlobMetadataStore implements IBlobMetadataStore {
leaseAccessConditions?: Models.LeaseAccessConditions,
modifiedAccessConditions?: Models.ModifiedAccessConditions
): Promise<Models.BlobPropertiesInternal> {
throw new Error("Method not implemented.");
throw new NotImplementedinSQLError(context.contextId);
}

public updateSequenceNumber(
Expand All @@ -2912,7 +2913,7 @@ export default class SqlBlobMetadataStore implements IBlobMetadataStore {
sequenceNumberAction: Models.SequenceNumberActionType,
blobSequenceNumber: number | undefined
): Promise<Models.BlobPropertiesInternal> {
throw new Error("Method not implemented.");
throw new NotImplementedinSQLError(context.contextId);
}

public appendBlock(
Expand All @@ -2924,7 +2925,7 @@ export default class SqlBlobMetadataStore implements IBlobMetadataStore {
| Models.AppendPositionAccessConditions
| undefined
): Promise<Models.BlobPropertiesInternal> {
throw new Error("Method not implemented.");
throw new NotImplementedinSQLError(context.contextId);
}

public async listUncommittedBlockPersistencyChunks(
Expand Down
2 changes: 1 addition & 1 deletion src/queue/errors/NotImplementedError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import StorageError from "./StorageError";
export default class NotImplementedError extends StorageError {
public constructor(requestID: string = "") {
super(
500,
501,
"APINotImplemented",
"Current API is not implemented yet. Please vote your wanted features to https://github.com/azure/azurite/issues",
requestID
Expand Down
Loading