Forum Discussion
Anonymous
2 years agoPlease insert code blocks using the code block option in the toolbar.
You should be setting the return code in a variable in your try/catch/finally block and returning that error code. Then you can just have a datapoint that looks at the return code. That also solves the problem of your current code not having a return code, which will cause LM to ignore the output.
return_code = 0
try {
sql.getConnection()
} catch (SQLException e) {
if (e.getMessage().contains("Login failed")) {
return_code = 1 // Invalid password or login failed
} else {
return_code = 2 // Other connection or server error, including server offline
}
} finally {
sql.close()
return return_code
}
Related Content
- 5 months ago
- 3 months ago