Automatically change .error to .catch.

Use this script to change .error to .catch using this linux script:

    #!/bin/bash -ex
    #Run in awx/awx/ui/client/src
    FILES=`grep -l -R "\.error(\s*function\s*(data,\s*status)\s*{" . | xargs`
    sed -i "s/\.error(\s*function\s*(data,\s*status)\s*{/.catch(({data, status}) => {/g" $FILES

    FILES=`grep -l -R "\.error(this\.error\.bind(this))" . | xargs`
    sed -i "s/\.error(this\.error\.bind(this))/\.catch(this\.catch\.bind(this))/g" $FILES

    FILES=`grep -l -R "\.error(\s*function\s*(error)\s*{" . | xargs`
    sed -i "s/\.error(\s*function\s*(error)\s*{/.catch(({error}) => {/g" $FILES

    FILES=`grep -l -R "\.error(\s*function\s*(obj,\s*status)\s*{" . | xargs`
    sed -i "s/\.error(\s*function\s*(obj,\s*status)\s*{/.catch(({obj, status}) => {/g" $FILES

    FILES=`grep -l -R "\.error(\s*function\s*(res,\s*status)\s*{" . | xargs`
    sed -i "s/\.error(\s*function\s*(res,\s*status)\s*{/.catch(({res, status}) => {/g" $FILES

    FILES=`grep -l -R "\.error(\s*function\s*(msg,\s*code)\s*{" . | xargs`
    sed -i "s/\.error(\s*function\s*(msg,\s*code)\s*{/.catch(({msg, code}) => {/g" $FILES

    FILES=`grep -l -R "\.error(\s*function\s*()\s*{" . | xargs`
    sed -i "s/\.error(\s*function\s*()\s*{/.catch(() => {/g" $FILES
This commit is contained in:
Ben Thomasson
2017-10-04 13:24:00 -04:00
committed by Marliana Lara
parent 834e6c692c
commit 7d767f8f63
86 changed files with 163 additions and 163 deletions

View File

@@ -144,7 +144,7 @@ export default ['Rest', 'Wait',
});
Wait('stop');
})
.error(function(data, status) {
.catch(({data, status}) => {
ProcessErrors($scope, data, status, form, {
hdr: 'Error!',
msg: 'Failed to retrieve notification: ' + id + '. GET status: ' + status
@@ -284,7 +284,7 @@ export default ['Rest', 'Wait',
$state.go('notifications', {}, { reload: true });
Wait('stop');
})
.error(function(data, status) {
.catch(({data, status}) => {
ProcessErrors($scope, data, status, form, {
hdr: 'Error!',
msg: 'Failed to add new notification template. POST returned status: ' + status