Why does these two WFS layers fail to render in QGIS? - gis

I tried to download the layers "River U Lancang","River Maintrib", and "Main River Line" in the following WFS server: https://geo.mrcmekong.org/geoserver/wms?service=wfs&request=GetCapabilities
Every other layer works, but these three layers throw back the following error:
2022-03-08T16:29:54 WARNING Error when parsing GetFeature response : Error: not well-formed (invalid token) on line 1, column 720
2022-03-08T16:29:54 WARNING Retrying request https://geo.mrcmekong.org/geoserver/wms?SERVICE=WFS&REQUEST=GetFeature&VERSION=1.0.0&TYPENAME=mrc:River U Lancang&SRSNAME=EPSG:32648&OUTPUTFORMAT=GML3: 2/3
2022-03-08T16:29:56 WARNING Error when parsing GetFeature response : Error: not well-formed (invalid token) on line 1, column 720
2022-03-08T16:29:56 WARNING Retrying request https://geo.mrcmekong.org/geoserver/wms

The response is using an invalid namespace mrc:River U Lancang gml:id="River U Lancang.1"> - You can't use spaces here. I think the only solution is to contact the owner of the service and ask them to fix this.

Related

The web3 JSON-RPC error message is not clearly, how to decode it?

When I ran a web3 function at Remix, it show me the full error message, then I can easily to debug and fix. But when I called function from my own frontend and Metamask, the error message is not clearly. You can check it here https://imgur.com/a/QS4q0ER ( pic1: remix, pic2: metamask )
By using estimateGas (https://ethereum.stackexchange.com/questions/21654/correct-syntax-for-estimating-gas-cost-of-a-function-in-web3/21765#21765) I can get the error message. But it's not clearly. I tried to decode data field. The result here https://i.imgur.com/8r3eF18.png . I can see the error message here, but not exactly in right format.
Please help me to decode the error message, using this hex string :
0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000017707269636520736c697070616765206465746563746564000000000000000000
Found it.
web3.eth.abi.encodeFunctionSignature('Error(string)') = '0x08c379a0'
Remove 0x08c379a0 in data string, and decode it:
web3.eth.abi.decodeParameter('string', '00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000017707269636520736c697070616765206465746563746564000000000000000000') = 'price slippage detected'

Postman/Newman junit report customization

I'm using postman and newman to perform automated tests and I do a JUnit export in order to exploit them in TFS.
However, when I open my .xml report, failures are indicated as follows:
-<failure type="AssertionFailure">
-<![CDATA[Failed 1 times.]]>
</failure>
I would like to know if it is possible to customize the "Failed 1 times." information in order to pass more relevant data about the failure (ie. json body error and description)
Thank you
Alexandre
Well, finally I found out how to proceed (not a clean way but sufficient for my purpose, so far):
I impact the file C:\Users\<myself>\AppData\Roaming\npm\node_modules\newman\lib\reporters\junit\index.js
Request's data and response can be recovered from 'executions' object:
stringExecutions = JSON.stringify(executions); //provide information about the arguments of the object "executions"
from this I can take general information by json-parsing this element and extracting what I want:
jsonExecutions = JSON.parse(stringExecutions)
jsonExecutions[0].response._details.code // gives me the http return code,
jsonExecutions[0].response._details.name // gives me the status,
jsonExecutions[0].response._details.detail //gives a bit more details
Error data (at test case/testsuite level) can be recovered from the 'err.error' object:
stringData = JSON.stringify(err.error); jsonData = JSON.parse(stringData);
from that I extract the data I need, ie.
jsonData.name // the error type
jsonData.message // the error detail
jsonData.stacktrace // the error stack
by the way, in the original file, stack cannot be displayed as there is no 'stack' argument in error.err (it is named 'stacktrace').
Finally failure data (at test step/testcase level) can be recovered from the 'failures' object:
stringFailure = JSON.stringify(failures); jsonFailure = JSON.parse(stringFailure);
from this I extract:
jsonFailure[0].name // the failure type
jsonFailure[0].stack // the failure stack
For my purpose, I add response details from jsonExecutions to my testsuite error data, which is much more verbose in the XML report than previousely.
If there is a cleaner/smarter way to perform this, do not hesitate to tell me, I'll be grateful
Next step : do it clean by creating a custom reporter. :)
Alexandre

Rvest parse.response 404 error is breaking my for loop. How to keep looping?

I have the following section of code nested within a for loop
mywebsite <- html(webstring)
cast <- html_nodes(mywebsite,".some-node")
text_of_cast<-html_text(cast)
The problem is that one of the URLs returns the following error:
Error in parse.response(r, parser, encoding = encoding) : client
error: (404) Not Found
And this error breaks my for loop because the page doesn't exist.
Is it possible to ignore this error and keep looping?
It sounds that the "try" function from the base package is what you are looking for.

firebase-import timing out?

I'm using the firebase-import tool to upload JSON data to my firebase. I consistently get the following error after trying to upload a JSON file that is ~40MB in size. Any ideas why? The output seems to be intentionally cryptic.
It always happens when the upload is 42% complete, and about that much of the JSON does get successfully uploaded to Firebase.
FIREBASE INTERNAL ERROR: Server Error: ClientId[------]:ErrorId[5]: Error on incoming message
Importing [==================== ] 42% (1610/3865)
/usr/local/lib/node_modules/firebase-import/node_modules/firebase/lib/firebase-node.js:44
function ac(a){try{a()}catch(b){setTimeout(function(){throw b;},Math.floor(0))
^
AssertionError: false == true
at onComplete (/usr/local/lib/node_modules/firebase-import/bin/firebase-import.js:222:7)
at /usr/local/lib/node_modules/firebase-import/node_modules/firebase/lib/firebase-node.js:128:47
at ac (/usr/local/lib/node_modules/firebase-import/node_modules/firebase/lib/firebase-node.js:44:20)
at X (/usr/local/lib/node_modules/firebase-import/node_modules/firebase/lib/firebase-node.js:128:22)
at /usr/local/lib/node_modules/firebase-import/node_modules/firebase/lib/firebase-node.js:121:291
at /usr/local/lib/node_modules/firebase-import/node_modules/firebase/lib/firebase-node.js:85:276
at md.h.bc (/usr/local/lib/node_modules/firebase-import/node_modules/firebase/lib/firebase-node.js:86:104)
at ad.bc (/usr/local/lib/node_modules/firebase-import/node_modules/firebase/lib/firebase-node.js:77:364)
at Q.Od (/usr/local/lib/node_modules/firebase-import/node_modules/firebase/lib/firebase-node.js:75:280)
at Ec (/usr/local/lib/node_modules/firebase-i
It turns out this particular error was due to a key path in the JSON exceeding Firebase's maximum key path length, which is 768 characters.

Rails 3: How to return errors in a JSON request?

How can I return a 800, 404, etc error when a user makes a JSON/XML request to my API?
I've tried
error 404, {:error => "ERror".to_json }
with no success.
Also, I've tried to put a "respond_to" but it doesn't work as well (it duplicates the respond_to and gives error).
Thanks
The same way you return such errors with html, it's part of the HTTP Header.
render json: #myobject, status: :unprocessable_entity
Update, response to comment:
You can get all the status codes from Rack. Rails passes the symbolized status to Rack
Rack::Utils.status_code(options[:status])
which simply matches the symbol to the list of status (the strings are converted to symbols)
Here is the smoking fresh list: https://github.com/rack/rack/blob/master/lib/rack/utils.rb#L575-L638
Scroll a bit lower and you'll see the status_code method. It's fun to read the source code!