(aHook)
| 141 | } |
| 142 | |
| 143 | createHook(aHook) { |
| 144 | if (aHook.functionName) { |
| 145 | return this.getFunction(aHook.functionName).then(result => { |
| 146 | if (result) { |
| 147 | throw new Parse.Error(143, `function name: ${aHook.functionName} already exists`); |
| 148 | } else { |
| 149 | return this.createOrUpdateHook(aHook); |
| 150 | } |
| 151 | }); |
| 152 | } else if (aHook.className && aHook.triggerName) { |
| 153 | return this.getTrigger(aHook.className, aHook.triggerName).then(result => { |
| 154 | if (result) { |
| 155 | throw new Parse.Error( |
| 156 | 143, |
| 157 | `class ${aHook.className} already has trigger ${aHook.triggerName}` |
| 158 | ); |
| 159 | } |
| 160 | return this.createOrUpdateHook(aHook); |
| 161 | }); |
| 162 | } |
| 163 | |
| 164 | throw new Parse.Error(143, 'invalid hook declaration'); |
| 165 | } |
| 166 | |
| 167 | updateHook(aHook) { |
| 168 | if (aHook.functionName) { |
nothing calls this directly
no test coverage detected