Jump to content

GetError as code, not text


This topic is 4939 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have a number of solutions in FX, now trying the Filemaker PHP API. I'd like to test the find result for the error code that indicates "No records match request."

The method getErrorString() and getMessage() both give me a text string. I know there's a numeric code hidden in there somewhere, but I don't see a method to retrieve it.

I could do this easily in FX, why not in PHP API?

Gary

Link to comment
Share on other sites

Whoa, I just figured it out. There's an undocumented method, getCode(), that yields the error code from the result if it's an error. So you still need to test for error as follows:

if(Filemaker::isError($result)) {

  echo "
Error Code: ".$result->getCode(). "";

  echo "
Error Message: ".$result->getMessage(). "";

}

Thanks to Jonathan Stark for the clues that lead me to this answer. http://jonathanstark.com/filemaker-api-for-php-documentation/FileMaker/FME.html

Add this to your cheat sheets.

Gary

Link to comment
Share on other sites

This topic is 4939 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.