Jump to content

Runtime Exception Handling in Modules


Hogie

Recommended Posts

I am currently writing a module that requires a direct database connection to the service.  I am using the minphp-db code, but I am trying to figure out how to capture a connection error when I am testing it in the Module::addModuleRow code, but the system is capturing it and throwing up:   

 Something went wrong.
SQLSTATE[HY000] [1045] Access denied for user 'xxxxxxx'@'remotehost' (using password: YES)

I'd like to figure out a way to capture that error so I can throw up an error to the user instead of a blank screen (which is what you get when Configure::errorReporting is set to 0).

 

Any ideas?  There is currently not an API available for what I am writing, so it needs to be a direct DB connection.

Link to comment
Share on other sites

1 hour ago, Paul said:

Are you using the Record component? See https://docs.blesta.com/display/dev/Database+Access

I do not see how to connect that to a different database.  Not the blesta database, but a remote database for the system I am trying to get blesta to talk to.  Since I will have multiple of these database clusters, I can not set the blesta and the service's databases to be the same since multiple clusters would have overlapping table names.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...