【问题标题】:Error in Grails for interating Nexmo plugin用于交互 Nexmo 插件的 Grails 错误
【发布时间】:2018-02-10 07:39:17
【问题描述】:

当我运行这段代码时:

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 ) {
               ^

我该如何解决这个问题?

【问题讨论】:

    标签: grails vonage


    【解决方案1】:

    尝试在 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
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-14
      • 1970-01-01
      • 1970-01-01
      • 2012-03-06
      • 1970-01-01
      相关资源
      最近更新 更多