netsuite
netsuite copied to clipboard
Get calls return item not found when the error is insufficient permission
Problem
When a user does not have permission to get a record, the gem reports an incorrect error
NetSuite::Records::CreditMemo.get(123)
Will yield
NetSuite::RecordNotFound: NetSuite::Records::CreditMemo with OPTIONS={:internal_id=>123} could not be found
When the error via the logs is:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:
xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<platformMsgs:documentInfo xmlns:platformMsgs="urn:messages_2016_2.platform.webservices.netsuite.com">
<platformMsgs:nsId>WEBSERVICES_4548666_071320171044796155483003071_7fce118d7b34</platformMsgs:nsId>
</platformMsgs:documentInfo>
</soapenv:Header>
<soapenv:Body>
<getResponse xmlns="urn:messages_2016_2.platform.webservices.netsuite.com">
<readResponse>
<platformCore:status xmlns:platformCore="urn:core_2016_2.platform.webservices.netsuite.com" isSuccess="false">
<platformCore:statusDetail type="ERROR">
<platformCore:code>INSUFFICIENT_PERMISSION</platformCore:code>
<platformCore:message>Permission Violation: You need the 'Transactions -> Credit Memo' permission to access thi
s page. Please contact your account administrator.</platformCore:message>
</platformCore:statusDetail>
</platformCore:status>
</readResponse>
</getResponse>
</soapenv:Body>
</soapenv:Envelope>
Expected Behavior
The gem raises a permission error instead.
@Senjai good catch! Would you mind submitting a PR to fix this bug?
@iloveitaly I'll try to find time to for sure. Can't promise anything immediate.
Hey @iloveitaly Just following up on this. I won't have time to patch it. Apologies :( If anyone else wants to take it fly at 'er