Azure / Azure/cosmos-explorer

Errors Not Reported by Mongo ARM creation

Open
#92 0 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
131
Forks
67
Avg merge
3d 13h
Merged PRs (30d)
10

Description

1. Create a Mongo collection that triggers an error. Example: Try creating a mongo collection with a shard key `/id`
2. Get back a cryptic `response.text()` is not a function error message

The issue is this line here: https://github.com/Azure/cosmos-explorer/blob/99c6a7ebcc7a03761d3af1f757513ad439ef1f8f/src/Common/MongoProxyClient.ts#L460-L463

The catch clause has an implicit `any` type on response. But in this case, it is not an instance of `Response`. It is a RP specific error format: https://github.com/Azure/cosmos-explorer/blob/99c6a7ebcc7a03761d3af1f757513ad439ef1f8f/src/ResourceProvider/ResourceProviderClient.ts#L184

TypeScript 4.0 has a fix for this https://devblogs.microsoft.com/typescript/announcing-typescript-4-0-beta/#unknown-on-catch

cc @vchske

Contributor guide

Open the contributing guide

Research direction

Start at src/Common/MongoProxyClient.ts around lines 460-463 and compare the RP-specific error format in src/ResourceProvider/ResourceProviderClient.ts around line 184. Reproduce the shard-key collection creation error and verify that the resulting message reports the underlying resource-provider error instead of the cryptic response.text() error.

Written by the indexing model from the issue text.

Assessment

Tech stack
mongodb, typescript
Domain
api, databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.