Skip to content
This repository has been archived by the owner on Jan 7, 2020. It is now read-only.

Commit

Permalink
MAID-2688 fix/error: adds missing error handling for failed app_recon…
Browse files Browse the repository at this point in the history
…nect (#252)
  • Loading branch information
hunterlester authored and bochaco committed Jun 21, 2018
1 parent 830f696 commit fe5dc54
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
13 changes: 7 additions & 6 deletions CHANGELOG.MD
Expand Up @@ -14,18 +14,19 @@
- Moves asynchronous app initialisation opertions out of SAFEApp constructor and into class method
- The `initializeApp` function is now asynchronous
- `webFetch` may receive multipart range requests
- changes fromAuthURI to fromAuthUri
- changes loginFromURI to loginFromUri
- uses delete instead of remove as entry mutation action
- changes initializeApp to use an s instead of z
- Changes fromAuthURI to fromAuthUri
- Changes loginFromURI to loginFromUri
- Uses delete instead of remove as entry mutation action
- Changes initializeApp to use an s instead of z
- Network state callback invoked from `INIT` to `CONNECTED` states
- Simplifies test helper functions
- Upgrades deps_downloader to v0.2.0
- isolates webFetch helper functions for testing
- unregistered client connection event triggers network status update
- Isolates webFetch helper functions for testing
- Unregistered client connection event triggers network status update

### Fixed
- Fixed some tests which were giving false positive results
- Adds missing error handling for app_reconnect to prevent false connection status

## SAFE libraries Dependencies
- safe_app: a9b4c05
Expand Down
3 changes: 3 additions & 0 deletions src/native/_app.js
Expand Up @@ -90,6 +90,9 @@ module.exports = {
return new Promise((resolve, reject) => {
const result_cb = ffi.Callback("void", [t.VoidPtr, t.FfiResultPtr], (user_data, resultPtr) => {
const result = helpers.makeFfiResult(resultPtr);
if (result.error_code !== 0) {
return reject(makeError(result.error_code, result.error_description));
}

app._networkStateUpdated(null, consts.NET_STATE_CONNECTED);
resolve(result);
Expand Down
16 changes: 0 additions & 16 deletions src/native/_nfs.js
Expand Up @@ -53,22 +53,6 @@ const readFileInfo = (fileInfo) => {
? new Buffer(0)
: new Buffer(ref.reinterpret(file.user_metadata_ptr, file.user_metadata_len));

if (user_metadata_ptr) {
try {
if(typeof user_metadata_ptr === 'object') {
user_metadata_ptr = user_metadata_ptr;
} else {
user_metadata_ptr = JSON.parse(user_metadata_ptr.toString());
}

} catch (e) {
// we can safely ignore this
if (console && console.warn) {
console.warn(`Parsing user metadata '${user_metadata_ptr}' of '${data_map_name}' failed: ${e}`)
}
}
}

let retFile = {
data_map_name,
size,
Expand Down

0 comments on commit fe5dc54

Please sign in to comment.