@@ -69,6 +69,27 @@ export class InputValidationError extends AgentCoreCLIError {
6969 }
7070}
7171
72+ /** Error raised when a command or operation has not been implemented yet. */
73+ export class NotImplementedError extends AgentCoreCLIError {
74+ constructor ( message ?: string , options ?: Omit < AgentCoreCLIErrorOptions , "source" > ) {
75+ super ( message ?? "not implemented yet" , { ...options , source : ERROR_SOURCE . INTERNAL } ) ;
76+ }
77+ }
78+
79+ /** Error raised when detecting an invalid environment */
80+ export class InvalidEnvironmentError extends AgentCoreCLIError {
81+ constructor ( message ?: string , options ?: Omit < AgentCoreCLIErrorOptions , "source" > ) {
82+ super ( message , { ...options , source : ERROR_SOURCE . USER } ) ;
83+ }
84+ }
85+
86+ export class SourceResolutionError extends InputValidationError {
87+ constructor ( message : string , options ?: ErrorOptions ) {
88+ super ( message , options ) ;
89+ this . name = "SourceResolutionError" ;
90+ }
91+ }
92+
7293/** Error raised when a JSON file cannot be read, parsed, or validated against its schema. */
7394export class DeserializationError extends AgentCoreCLIError {
7495 constructor (
@@ -92,32 +113,16 @@ export class NoProjectError extends AgentCoreCLIError {
92113 }
93114}
94115
95- /** Error raised when a command or operation has not been implemented yet. */
96- export class NotImplementedError extends AgentCoreCLIError {
97- constructor ( message ?: string , options ?: Omit < AgentCoreCLIErrorOptions , "source" > ) {
98- super ( message ?? "not implemented yet" , { ...options , source : ERROR_SOURCE . INTERNAL } ) ;
99- }
100- }
101-
102- /** Error raised when detecting an invalid environment */
103- export class InvalidEnvironmentError extends AgentCoreCLIError {
104- constructor ( message ?: string , options ?: Omit < AgentCoreCLIErrorOptions , "source" > ) {
105- super ( message , { ...options , source : ERROR_SOURCE . USER } ) ;
106- }
107- }
108-
109- export class SourceResolutionError extends InputValidationError {
110- constructor ( message : string , options ?: ErrorOptions ) {
111- super ( message , options ) ;
112- this . name = "SourceResolutionError" ;
113- }
114- }
115-
116- // TODO: attach telemetry metadata to this error class.
117- export class DeserializationError extends Error {
118- constructor ( path : string , options ?: { cause ?: unknown } ) {
119- super ( `Failed to deserialize JSON at "${ path } "` , options ) ;
120- this . name = "DeserializationError" ;
116+ /** Thrown when a project's agentcore.json exists but cannot be parsed or fails validation. */
117+ export class InvalidProjectConfigError extends AgentCoreCLIError {
118+ constructor (
119+ public readonly configPath : string ,
120+ detail : string ,
121+ ) {
122+ super ( `invalid project config at ${ configPath } : ${ detail } ` , {
123+ source : ERROR_SOURCE . USER ,
124+ meta : { configPath } ,
125+ } ) ;
121126 }
122127}
123128
0 commit comments