File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -226,18 +226,27 @@ async function _addCurrentProject() {
226226 const name = await showInputModal ( 'プロジェクトを保存' , 'プロジェクト名' , suggested ) ;
227227 if ( ! name ) return ;
228228
229- await fetch ( '/api/grepnavi' , {
229+ const gnRes = await fetch ( '/api/grepnavi' , {
230230 method : 'POST' ,
231231 headers : { 'Content-Type' : 'application/json' } ,
232232 body : JSON . stringify ( { root, graph : graphPath } ) ,
233233 } ) ;
234+ if ( ! gnRes . ok ) {
235+ const gnErr = await gnRes . json ( ) . catch ( ( ) => ( { } ) ) ;
236+ alert ( '.grepnaviの書き込みに失敗しました: ' + ( gnErr . error || gnRes . status ) ) ;
237+ return ;
238+ }
234239
235240 const res = await fetch ( '/api/projects' , {
236241 method : 'POST' ,
237242 headers : { 'Content-Type' : 'application/json' } ,
238243 body : JSON . stringify ( { name, grepnaviFile : gnPath } ) ,
239244 } ) ;
240- if ( ! res . ok ) { alert ( '保存に失敗しました' ) ; return ; }
245+ if ( ! res . ok ) {
246+ const err = await res . json ( ) . catch ( ( ) => ( { } ) ) ;
247+ alert ( '保存に失敗しました: ' + ( err . error || res . status ) ) ;
248+ return ;
249+ }
241250 _projectsData = await res . json ( ) ;
242251 const added = _projectsData . find ( p => ( p . grepnaviFile || '' ) . replace ( / \\ / g, '/' ) === gnPath ) ;
243252 if ( added ) _expandedProjects . add ( added . id ) ;
You can’t perform that action at this time.
0 commit comments