-
Notifications
You must be signed in to change notification settings - Fork 367
log url on instant-cli errors (#2806) [bump to v1.0.55] #2806
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import { HttpClientResponse } from '@effect/platform'; | ||
| import { Effect, Schema, Option } from 'effect'; | ||
| import { InstantHttpAuthed } from '../lib/http.ts'; | ||
| import { getBaseUrl, InstantHttpAuthed } from '../lib/http.ts'; | ||
| import { version } from '@instantdb/version'; | ||
| import { CurrentApp } from '../context/currentApp.ts'; | ||
|
|
||
|
|
@@ -21,6 +21,7 @@ export const DashAppResponse = Schema.Struct({ | |
|
|
||
| export const infoCommand = () => | ||
| Effect.gen(function* () { | ||
| const baseUrl = yield* getBaseUrl; | ||
| const authedHttp = yield* Effect.serviceOption(InstantHttpAuthed).pipe( | ||
| Effect.map(Option.getOrNull), | ||
| ); | ||
|
|
@@ -32,7 +33,10 @@ export const infoCommand = () => | |
| const meData = yield* authedHttp.get('/dash/me').pipe( | ||
| Effect.flatMap(HttpClientResponse.schemaBodyJson(DashMeResponse)), | ||
| Effect.mapError( | ||
| (e) => new Error("Couldn't get user information.", { cause: e }), | ||
| (e) => | ||
| new Error(`Couldn't get user information (${baseUrl}).`, { | ||
| cause: e, | ||
| }), | ||
|
Comment on lines
+36
to
+39
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Apply URL context to the app fetch as well. This 🤖 Prompt for AI Agents
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the later /dash/apps request can fail but ti will fail as an InstantHttpError which will print the url.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
ast-grep outline client/packages/cli/src/layer.ts --items all
printf '\n--- InstantHttpError definitions and relevant usage ---\n'
rg -n -C 5 '\bInstantHttpError\b|\bInstantHTTPError\b|function printRedErrors|const printRedErrors|printRedErrors\s*=' client/packages/cli/src
printf '\n--- info command request/error handling ---\n'
sed -n '20,65p' client/packages/cli/src/commands/info.tsLength of output: 9912 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- InstantHttpError printer ---'
sed -n '70,110p' client/packages/cli/src/layer.ts
printf '%s\n' '--- HTTP client status-error transformation ---'
sed -n '45,125p' client/packages/cli/src/lib/http.ts
printf '%s\n' '--- Existing dashboard schema error wrappers ---'
rg -n -C 4 'schemaBodyJson\(Dash(App|Me)Response\)|Couldn.t get (user|app) information' client/packages/cli/srcLength of output: 6750
The remaining case is a 2xx response that fails So the requested wrapping is only needed for that decode-error path; the HTTP-error path is already handled as you described. You are interacting with an AI system.
Comment on lines
+36
to
+39
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Redact sensitive URL components before logging.
🤖 Prompt for AI Agents |
||
| ), | ||
| ); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.