Skip to content

Stack traces display incorrect line numbers #259

@RishabhKarnad

Description

@RishabhKarnad

Description of the bug
If an error is thrown in a Vue SFC, the line number of the statement that threw the error is incorrect.

To Reproduce
Steps to reproduce the behaviour:

  1. Create SFC in .vue file
  2. Throw an error in the <script> part of the SFC and don't handle it
  3. View the stack trace in the error screen on the device/simulator or in the debugging tools

What I expected
The line number should match the line number in the user's source code

Code sample

<script>
export default {
  data() {
    return {
      message: 'Hello',
    };
  },
  methods: {
    p() {
      this.message += '!';
    },
  },
  mounted() {
    function t() {
      throw new Error('Mock error'); // line 15
    }
    t(); // line 17
    console.log(10 < 20);
  },
};
</script>

<template>
  <view class="container">
    <text class="text-color-primary">My Vue Native App</text>
    <text class="text-color-primary">{{ message }}</text>
    <button title="Press" @press="p" />
  </view>
</template>

<style>
.container {
  background-color: white;
  align-items: center;
  justify-content: center;
  flex: 1;
}
.text-color-primary {
  color: blue;
}
</style>

Screenshots

Did I use vue-native-cli to create the project?
Yes

Am I using Expo?
Yes, although it also occurs on bare RN based projects

Development platform:

  • OSX Catalina 10.15.4
  • ZSH

The device on which I run my Vue Native app

  • Device: any iPhone or Android device
  • OS: all supported variants

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions