• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

i-net-software / jlessc / 281

pending completion
281

push

travis-ci-com

volker
Handle doubled rule correctly in the compressed formatter if previous
rule ends with an block

5 of 5 new or added lines in 1 file covered. (100.0%)

3586 of 3873 relevant lines covered (92.59%)

2.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

65.0
/src/com/inet/lib/less/LessException.java
1
/**
2
 * MIT License (MIT)
3
 *
4
 * Copyright (c) 2014 - 2020 Volker Berlin
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7
 * of this software and associated documentation files (the "Software"), to deal
8
 * in the Software without restriction, including without limitation the rights
9
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
 * copies of the Software, and to permit persons to whom the Software is
11
 * furnished to do so, subject to the following conditions:
12
 *
13
 * The above copyright notice and this permission notice shall be included in
14
 * all copies or substantial portions of the Software.
15
 *
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
 * UT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
 * THE SOFTWARE.
23
 *
24
 * @author Volker Berlin
25
 * @license: The MIT license <http://opensource.org/licenses/MIT>
26
 */
27
package com.inet.lib.less;
28

29
import java.util.ArrayList;
30
import java.util.List;
31

32
/**
33
 * A exception that occur if some can not parse or converted.
34
 */
35
public class LessException extends RuntimeException {
36

37
    private List<LessFilePosition> positions = new ArrayList<>();
3✔
38

39
    /**
40
     * Constructs a new less exception with the specified detail message.
41
     *
42
     * @param message
43
     *            the detail message.
44
     */
45
    public LessException( String message ) {
46
        super( message );
3✔
47
    }
3✔
48

49
    /**
50
     * Constructs a new runtime exception with the specified cause.
51
     *
52
     * @param cause
53
     *            the cause
54
     */
55
    public LessException( Throwable cause ) {
56
        super( cause );
×
57
    }
×
58

59
    /**
60
     * Constructs a new runtime exception with the specified detail message and cause.
61
     *
62
     * @param message
63
     *            the detail message.
64
     * @param cause
65
     *            the cause
66
     */
67
    public LessException( String message, Throwable cause ) {
68
        super( message, cause );
×
69
    }
×
70

71
    /**
72
     * Add a position to the less file stacktrace
73
     * @param filename the less file, can be null if a string was parsed
74
     * @param line the line number in the less file
75
     * @param column the column in the less file
76
     */
77
    void addPosition( String filename, int line, int column ) {
78
        LessFilePosition pos = new LessFilePosition( filename, line, column );
3✔
79
        if( !positions.contains( pos ) ) {
3✔
80
            this.positions.add( pos );
3✔
81
        }
82
    }
3✔
83

84
    /**
85
     * Get the less file stacktrace
86
     * @return the stack
87
     */
88
    public List<LessFilePosition> getPositions() {
89
        return new ArrayList<>( positions );
×
90
    }
91

92
    /**
93
     * The message without stacktrace.
94
     * @return the message
95
     */
96
    public String getOriginalMessage() {
97
        return super.getMessage();
×
98
    }
99

100
    /**
101
     * The message plus the less file stacktrace.
102
     * {@inheritDoc}
103
     */
104
    @Override
105
    public String getMessage() {
106
        StringBuilder builder = new StringBuilder( super.getMessage() );
3✔
107
        for( LessFilePosition pos : positions ) {
3✔
108
            builder.append( "\n\t on line " ).append( pos.getLine() ).append( ", column " ).append( pos.getColumn() );
3✔
109
            if( pos.getFilename() != null ) {
3✔
110
                builder.append( ", file " ).append( pos.getFilename() );
×
111
            }
112
        }
3✔
113
        return builder.toString();
3✔
114
    }
115
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc