grails - Grails用于插入Nexmo插件的错误

标签 grails nexmo

当我运行此代码时:

package nexmo

class SmsControllerController {

    // Inject the service
    def nexmoService

    def index() {
        def smsResult
        def callResult

        try {
            // Send the message "What's up?" to 1-500-123-4567
            smsResult = nexmoService.sendSms("61451062006", "What's up?")

            // Call the number and tell them a message
            callResult = nexmoService.call("61451062006", "Have a great day! Goodbye.")

            catch (NexmoException e ) {
                // Handle error if failure
            }
        }
    }
}

我收到以下错误消息:
Error Compilation error: startup failed:
C:\nexmo-master\grails-app\controllers\nexmo\SmsController.groovy: 19: unexpected token: catch @ line 19, column 13.
               catch (NexmoException e ) {
               ^

我该如何解决这个问题?

最佳答案

在catch语句之前,请尝试关闭try语句。

try {
    // Send the message "What's up?" to 1-500-123-4567
    smsResult = nexmoService.sendSms("61451062006", "What's up?")

    // Call the number and tell them a message
    callResult = nexmoService.call("61451062006", "Have a great day! Goodbye.")
}
catch (NexmoException e ) {
        // Handle error if failure
}

关于grails - Grails用于插入Nexmo插件的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32961761/

相关文章:

audio - Websocket丢帧?

audio - 如何在Nexmo中列出通话录音?

Grails 按需执行任务

grails - Grails 中的 YML 配置始终真实

grails - grails 2或更高版本的log4j配置,对dailyRollOver不起作用

java.lang.AbstractMethodError : I get this exception when I am trying to initiate an outbound voice call using nexmo(vonage) API

file - grails 3.3.9从输入获取文件

grails - Grails筛选条件,条件查询,仅显式项目,特殊情况

grails - 连接SMS插件时出现Grails错误