File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 55 branches :
66 - main
77
8+ permissions :
9+ issues : write
10+ contents : read
11+
812jobs :
913 test :
1014 runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 33const { default : HackMD } = require ( '@hackmd/api' )
44const defaultNotesTemplate = require ( './default-notes-template' )
55
6- module . exports . create = function createNote ( notesTemplate , opts ) {
6+ module . exports . create = async function createNote ( notesTemplate , opts ) {
77 const note = typeof notesTemplate === 'function' ? notesTemplate ( opts ) : notesTemplate || defaultNotesTemplate ( opts )
8- const hackmd = new HackMD ( )
98
10- return hackmd . newNote ( note )
9+ try {
10+ const hackmd = new HackMD ( )
11+ return await hackmd . newNote ( note )
12+ } catch ( e ) {
13+ console . error ( 'failed to create hackMD note:' , e . message )
14+ console . log ( `note would have been:\n${ note } ` )
15+ return null
16+ }
1117}
1218
1319async function getNotesTemplate ( client , opts ) {
You can’t perform that action at this time.
0 commit comments