Skip to content

Commit

Permalink
[opt](iceberg) opt the error msg when create db which already exists (a…
Browse files Browse the repository at this point in the history
…pache#46334)

### What problem does this PR solve?

before:
```
mysql> create database cmytest;
ERROR 1105 (HY000): errCode = 2, detailMessage = Failed to create database: cmytest, error message is:null
```

after:
```
mysql> create database cmytest;
ERROR 1105 (HY000): errCode = 2, detailMessage = Failed to create database: cmytest: org.apache.doris.common.DdlException: errCode = 2, detailMessage = Can't create database 'cmytest'; database exists
```
  • Loading branch information
morningman authored Jan 4, 2025
1 parent 8f87a96 commit 0826537
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.doris.common.ErrorReport;
import org.apache.doris.common.UserException;
import org.apache.doris.common.security.authentication.PreExecutionAuthenticator;
import org.apache.doris.common.util.Util;
import org.apache.doris.datasource.DorisTypeVisitor;
import org.apache.doris.datasource.ExternalCatalog;
import org.apache.doris.datasource.ExternalDatabase;
Expand Down Expand Up @@ -125,7 +126,7 @@ public void createDb(CreateDbStmt stmt) throws DdlException {
});
} catch (Exception e) {
throw new DdlException("Failed to create database: "
+ stmt.getFullDbName() + ", error message is:" + e.getMessage(), e);
+ stmt.getFullDbName() + ": " + Util.getRootCauseMessage(e), e);
}
}

Expand Down

0 comments on commit 0826537

Please sign in to comment.