File tree Expand file tree Collapse file tree 3 files changed +35
-18
lines changed Expand file tree Collapse file tree 3 files changed +35
-18
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import {flags} from '@heroku-cli/command'
33import { Args , ux } from '@oclif/core'
44import Command from '../../../lib/base'
55import type { ModelResource } from '@heroku/ai'
6- import appAddons from '../../../lib/ai/models/app_addons'
6+
77import * as Heroku from '@heroku-cli/schema'
88
99export default class Info extends Command {
@@ -74,7 +74,9 @@ export default class Info extends Command {
7474 } else {
7575 const provisionedModelsInfo : Record < string , string | undefined > [ ] = [ ]
7676 const inferenceRegex = / i n f e r e n c e /
77- const addonsResponse = await appAddons ( this . config , app )
77+ const { body : addonsResponse } = await this . heroku . get < Heroku . AddOn > ( `/apps/${ app } /addons` , {
78+ headers : { 'Accept-Expansion' : 'plan' } ,
79+ } )
7880
7981 for ( const addonInfo of addonsResponse as Array < Heroku . AddOn > ) {
8082 const addonType = addonInfo . addon_service ?. name || ''
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -168,4 +168,35 @@ describe('ai:models:info', function () {
168168 }
169169 } )
170170 } )
171+
172+ context ( 'when app does not exist' , function ( ) {
173+ beforeEach ( function ( ) {
174+ process . env = { }
175+ api = nock ( 'https://api.heroku.com:443' )
176+ } )
177+
178+ afterEach ( function ( ) {
179+ process . env = env
180+ nock . cleanAll ( )
181+ } )
182+
183+ it ( 'shows clean error message without addon context' , async function ( ) {
184+ api
185+ . get ( '/apps/nonexistent-app/addons' )
186+ . reply ( 404 , {
187+ id : 'not_found' ,
188+ message : 'Couldn\'t find that app.' ,
189+ } )
190+
191+ try {
192+ await runCommand ( Cmd , [
193+ '--app' ,
194+ 'nonexistent-app' ,
195+ ] )
196+ } catch ( error ) {
197+ const { message} = error as CLIError
198+ expect ( stripAnsi ( message ) ) . to . equal ( 'Couldn\'t find that app.\n\nError ID: not_found' )
199+ }
200+ } )
201+ } )
171202} )
You can’t perform that action at this time.
0 commit comments