Skip to content

Commit

Permalink
fix(logic): correct error messages
Browse files Browse the repository at this point in the history
Co-authored-by: Arnaud Mimart <33665250+amimart@users.noreply.github.com>
  • Loading branch information
ccamel and amimart authored Jun 24, 2023
1 parent a5ef9ee commit f67c48b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions x/logic/predicate/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func Open(vm *engine.VM, sourceSink, mode, stream, options engine.Term, k engine
case engine.Atom:
name = s.String()
default:
return engine.Error(fmt.Errorf("open/4: invalid domain for source, should be an atom, give %T", s))
return engine.Error(fmt.Errorf("open/4: invalid domain for source, should be an atom, got %T", s))
}

var streamMode ioMode
Expand All @@ -111,11 +111,11 @@ func Open(vm *engine.VM, sourceSink, mode, stream, options engine.Term, k engine
return engine.Error(fmt.Errorf("open/4: invalid open mode (read | write | append)"))
}
default:
return engine.Error(fmt.Errorf("open/4: invalid domain for open mode, should be an atom, give %T", m))
return engine.Error(fmt.Errorf("open/4: invalid domain for open mode, should be an atom, got %T", m))
}

if _, ok := env.Resolve(stream).(engine.Variable); !ok {
return engine.Error(fmt.Errorf("open/4: stream can only be a variable, give %T", env.Resolve(stream)))
return engine.Error(fmt.Errorf("open/4: stream can only be a variable, got %T", env.Resolve(stream)))
}

if streamMode != ioModeRead {
Expand All @@ -124,7 +124,7 @@ func Open(vm *engine.VM, sourceSink, mode, stream, options engine.Term, k engine

f, err := vm.FS.Open(name)
if err != nil {
return engine.Error(fmt.Errorf("open/4: failed open stream: %w", err))
return engine.Error(fmt.Errorf("open/4: couldn't open stream: %w", err))
}
s := engine.NewInputTextStream(f)

Expand Down

0 comments on commit f67c48b

Please sign in to comment.