Fix unmarshalling issues and adjust logging for debugging

Modify `FunctionCall` struct to handle arguments as strings. Add debugging logs to facilitate error tracing and improve JSON unmarshalling in various functions.
This commit is contained in:
2024-11-11 00:23:00 -05:00
parent a83d5f9822
commit 7a43e3a5c8
5 changed files with 82 additions and 20 deletions

View File

@@ -72,6 +72,18 @@ func (d *Directory) AutoCleanupRoutine(ctx context.Context) error {
}
}
func (d *Directory) openFileForWriting(key string) (*os.File, error) {
path := d.GetPath(key)
fp, err := os.Create(path)
if err != nil {
return nil, err
}
return fp, nil
}
func (d *Directory) openFile(key string) (*os.File, error) {
path := d.GetPath(key)
@@ -91,7 +103,7 @@ func (d *Directory) Set(key string, value io.Reader) error {
d.lock.Lock()
defer d.lock.Unlock()
fp, err := d.openFile(key)
fp, err := d.openFileForWriting(key)
if err != nil {
return err
}
@@ -109,7 +121,7 @@ func (d *Directory) SetJSON(key string, value any) error {
d.lock.Lock()
defer d.lock.Unlock()
fp, err := d.openFile(key)
fp, err := d.openFileForWriting(key)
if err != nil {
return err
}