@@ -7,7 +7,7 @@ import GenericCheckboxPrompt from "./gui/GenericCheckboxPrompt/genericCheckboxPr
77import type { IChoiceExecutor } from "./IChoiceExecutor" ;
88import type QuickAdd from "./main" ;
99import type IChoice from "./types/choices/IChoice" ;
10- import { log } from "./logger/logManager " ;
10+ import { reportError } from "./utils/errorUtils " ;
1111import { CompleteFormatter } from "./formatters/completeFormatter" ;
1212import { getDate } from "./utilityObsidian" ;
1313import { MarkdownView } from "obsidian" ;
@@ -70,7 +70,7 @@ export class QuickAddApi {
7070 ) => {
7171 const choice : IChoice = plugin . getChoiceByName ( choiceName ) ;
7272 if ( ! choice )
73- log . logError ( `choice named '${ choiceName } ' not found`) ;
73+ reportError ( new Error ( `Choice named '${ choiceName } ' not found`) , "API executeChoice error" ) ;
7474
7575 if ( variables ) {
7676 Object . keys ( variables ) . forEach ( ( key ) => {
@@ -171,7 +171,7 @@ export class QuickAddApi {
171171 ) ;
172172
173173 if ( ! assistantRes ) {
174- log . logError ( "AI Assistant returned null" ) ;
174+ reportError ( new Error ( "AI Assistant returned null" ) , "AI Prompt error ") ;
175175 return { } ;
176176 }
177177
@@ -262,7 +262,7 @@ export class QuickAddApi {
262262 ) ;
263263
264264 if ( ! assistantRes ) {
265- log . logError ( "AI Assistant returned null" ) ;
265+ reportError ( new Error ( "AI Assistant returned null" ) , "Chunked AI Prompt error ") ;
266266 return { } ;
267267 }
268268
@@ -301,14 +301,12 @@ export class QuickAddApi {
301301 app . workspace . getActiveViewOfType ( MarkdownView ) ;
302302
303303 if ( ! activeView ) {
304- log . logError (
305- "no active view - could not get selected text."
306- ) ;
304+ reportError ( new Error ( "No active view" ) , "Could not get selected text" ) ;
307305 return ;
308306 }
309307
310308 if ( ! activeView . editor . somethingSelected ( ) ) {
311- log . logError ( "no text selected. ") ;
309+ reportError ( new Error ( "No text selected" ) , "Could not get selected text ") ;
312310 return ;
313311 }
314312
@@ -422,4 +420,4 @@ export class QuickAddApi {
422420 return undefined ;
423421 }
424422 }
425- }
423+ }
0 commit comments