Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Provide better error message when there's no CD in the drive #385

Closed
Freso opened this issue Mar 17, 2019 · 1 comment
Closed

Provide better error message when there's no CD in the drive #385

Freso opened this issue Mar 17, 2019 · 1 comment
Assignees
Labels
Accepted Accepted issue on our roadmap Design Design or UX/UI related Improvement Minor improvement to code Needed: patch A pull request is required Needed: tests Tests are required Priority: medium Medium priority Status: in progress Issue/pull request which is currently being worked on
Milestone

Comments

@Freso
Copy link
Member

Freso commented Mar 17, 2019

Currently whipper cd rip gives an ugly traceback if there's no CD in the tray/drive (see below). This should get caught and a nice(r!) message should be served to the user.

> whipper cd rip -O "~/tmp/" -W "~/tmp/"
INFO:whipper.command.cd:using configured read offset 6
INFO:whipper.command.cd:checking device /dev/sr0
eject: Cd-rom-kommandoen luk skuffen mislykkedes: Inddata/uddata-fejl
Traceback (most recent call last):
  File "/home/freso/.local/share/virtualenvs/whipper-dev/lib/python2.7/site-packages/whipper/extern/task/task.py", line 521, in c
    callable_task(*args, **kwargs)
  File "/home/freso/.local/share/virtualenvs/whipper-dev/lib/python2.7/site-packages/whipper/program/cdrdao.py", line 111, in _read
    self._done()
  File "/home/freso/.local/share/virtualenvs/whipper-dev/lib/python2.7/site-packages/whipper/program/cdrdao.py", line 149, in _done
    self.toc.parse()
  File "/home/freso/.local/share/virtualenvs/whipper-dev/lib/python2.7/site-packages/whipper/image/toc.py", line 192, in parse
    handle = codecs.open(self._path, "r", "utf-8")
  File "/home/freso/.local/share/virtualenvs/whipper-dev/lib/python2.7/codecs.py", line 898, in open
    file = __builtin__.open(filename, mode, buffering)
IOError: [Errno 2] No such file or directory: u'/tmp/tmpjLqkLr.cdrdao.read-toc.whipper.task'
CRITICAL:whipper.command.main:exception IOError at /home/freso/.local/share/virtualenvs/whipper-dev/lib/python2.7/codecs.py:898: open(): [Errno 2] No such file or directory: u'/tmp/tmpjLqkLr.cdrdao.read-toc.whipper.task'
Traceback (most recent call last):
  File "/home/freso/.local/share/virtualenvs/whipper-dev/lib/python2.7/site-packages/whipper/extern/task/task.py", line 521, in c
    callable_task(*args, **kwargs)
  File "/home/freso/.local/share/virtualenvs/whipper-dev/lib/python2.7/site-packages/whipper/program/cdrdao.py", line 111, in _read
    self._done()
  File "/home/freso/.local/share/virtualenvs/whipper-dev/lib/python2.7/site-packages/whipper/program/cdrdao.py", line 149, in _done
    self.toc.parse()
  File "/home/freso/.local/share/virtualenvs/whipper-dev/lib/python2.7/site-packages/whipper/image/toc.py", line 192, in parse
    handle = codecs.open(self._path, "r", "utf-8")
  File "/home/freso/.local/share/virtualenvs/whipper-dev/lib/python2.7/codecs.py", line 898, in open
    file = __builtin__.open(filename, mode, buffering)
IOError: [Errno 2] No such file or directory: u'/tmp/tmpjLqkLr.cdrdao.read-toc.whipper.task'
@Freso Freso added Priority: medium Medium priority Design Design or UX/UI related Improvement Minor improvement to code Needed: tests Tests are required Needed: patch A pull request is required labels Mar 17, 2019
@JoeLametta JoeLametta added this to the 1.0 milestone Nov 28, 2019
@JoeLametta JoeLametta added the Accepted Accepted issue on our roadmap label Nov 28, 2019
@JoeLametta JoeLametta self-assigned this Dec 3, 2019
JoeLametta added a commit that referenced this issue Sep 17, 2020
Fixes #385.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
JoeLametta added a commit that referenced this issue Sep 17, 2020
Fixes #385.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
JoeLametta added a commit that referenced this issue Sep 17, 2020
Fixes #385.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
@JoeLametta
Copy link
Collaborator

JoeLametta commented Sep 17, 2020

I've found this answer which may help us solve the issue.

Relevant Linux Kernel documentation (1, 2, 3):

    CDROM_DRIVE_STATUS		Get tray position, etc.

        usage:

        int slot;
        ioctl(fd, CDROM_DRIVE_STATUS, slot);

        inputs:
        Slot number to be tested, always zero except for jukeboxes.
        May also be special values CDSL_NONE or CDSL_CURRENT

        outputs:
        Ioctl return value will be one of the following values
        from <linux/cdrom.h>:

            CDS_NO_INFO		Information not available.
            CDS_NO_DISC
            CDS_TRAY_OPEN
            CDS_DRIVE_NOT_READY
            CDS_DISC_OK
            -1			error

        error returns:
        ENOSYS	Drive can't detect drive status
        EINVAL	Slot number beyond capacity of drive
        ENOMEM	Out of memory
#define CDROM_DRIVE_STATUS	0x5326  /* Get tray position, etc. */
/* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */
#define CDS_NO_INFO		0	/* if not implemented */
#define CDS_NO_DISC		1
#define CDS_TRAY_OPEN		2
#define CDS_DRIVE_NOT_READY	3
#define CDS_DISC_OK		4

JoeLametta added a commit that referenced this issue Sep 17, 2020
Fixes #385.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
@JoeLametta JoeLametta added the Status: in progress Issue/pull request which is currently being worked on label Sep 17, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Accepted Accepted issue on our roadmap Design Design or UX/UI related Improvement Minor improvement to code Needed: patch A pull request is required Needed: tests Tests are required Priority: medium Medium priority Status: in progress Issue/pull request which is currently being worked on
Projects
None yet
Development

No branches or pull requests

2 participants