Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f31980e

Browse files
committed
Merge branch 'psql-command-errors' into 'master'
fix: process psql errors with successful exit code See merge request postgres-ai/joe!189
2 parents 2708d10 + bc992c0 commit f31980e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎pkg/transmission/pgtransmission/transmitter.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ func (tr Transmitter) Run(commandParam string) (string, error) {
4646
out, err := tr.runPsql(cmdStr)
4747
if err != nil {
4848
if runnerError, ok := err.(runners.RunnerError); ok {
49+
if runnerError.ExitStatus == 0 {
50+
errMessage := runnerError.Stderr
51+
if _, after, found := strings.Cut(runnerError.Stderr, "error: "); found {
52+
errMessage = after
53+
}
54+
55+
return "", errors.New(errMessage)
56+
}
57+
4958
return "", fmt.Errorf("psql error: %w", runnerError)
5059
}
5160

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /